diff --git a/pcbnew/exporters/step/step_pcb_model.cpp b/pcbnew/exporters/step/step_pcb_model.cpp index 46aea89a6d..6a64782121 100644 --- a/pcbnew/exporters/step/step_pcb_model.cpp +++ b/pcbnew/exporters/step/step_pcb_model.cpp @@ -857,7 +857,7 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool gp_Pnt point( pcbIUScale.IUTomm( aPad->GetX() - aOrigin.x ), -pcbIUScale.IUTomm( aPad->GetY() - aOrigin.y ), Zpos + thickness ); - m_pad_points[name] = { point, testShape }; + m_pad_points[name].emplace_back( point, testShape ); } } } @@ -2387,34 +2387,37 @@ bool STEP_PCB_MODEL::WriteXAO( const wxString& aFileName ) Bnd_Box bbox; BRepBndLib::Add( subShape, bbox ); - for( const auto& [padKey, pair] : m_pad_points ) + for( const auto& [padKey, pairs] : m_pad_points ) { - const auto& [point, padTestShape] = pair; + for( const auto& pair : pairs ) + { + const auto& [point, padTestShape] = pair; - if( bbox.IsOut( point ) ) - continue; + if( bbox.IsOut( point ) ) + continue; - BRepAdaptor_Surface surface( TopoDS::Face( subShape ) ); + BRepAdaptor_Surface surface( TopoDS::Face( subShape ) ); - if( surface.GetType() != GeomAbs_Plane ) - continue; + if( surface.GetType() != GeomAbs_Plane ) + continue; - BRepExtrema_DistShapeShape dist( padTestShape, subShape ); - dist.Perform(); + BRepExtrema_DistShapeShape dist( padTestShape, subShape ); + dist.Perform(); - if( !dist.IsDone() ) - continue; + if( !dist.IsDone() ) + continue; - if( dist.Value() < Precision::Approximation() ) - { - // Push as a face group - groups[2][padKey].push_back( faceIndex ); + if( dist.Value() < Precision::Approximation() ) + { + // Push as a face group + groups[2][padKey].push_back( faceIndex ); - GProp_GProps system; - BRepGProp::SurfaceProperties( subShape, system ); + GProp_GProps system; + BRepGProp::SurfaceProperties( subShape, system ); - double surfaceArea = system.Mass() / 1e6; // Convert to meters^2 - groupAreas[padKey] = surfaceArea; + double surfaceArea = system.Mass() / 1e6; // Convert to meters^2 + groupAreas[padKey] += surfaceArea; + } } } diff --git a/pcbnew/exporters/step/step_pcb_model.h b/pcbnew/exporters/step/step_pcb_model.h index b4da8bb728..4a9bddbe04 100644 --- a/pcbnew/exporters/step/step_pcb_model.h +++ b/pcbnew/exporters/step/step_pcb_model.h @@ -292,8 +292,8 @@ private: std::vector m_board_silkscreen; std::vector m_board_soldermask; - // Data for pads - std::map> m_pad_points; + // Data for pads. Key example: Pad_F_U2_1_GND + std::map>> m_pad_points; /// Name of the PCB, which will most likely be the file name of the path. wxString m_pcbName;