Browse Source

OCCT 3D model export: don't skip pads with duplicate pad numbers for pad points data.

(cherry picked from commit dfb66e2fdb)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
revert-0c36e162
dsa-t 6 months ago
parent
commit
4faa00e262
  1. 43
      pcbnew/exporters/step/step_pcb_model.cpp
  2. 4
      pcbnew/exporters/step/step_pcb_model.h

43
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;
}
}
}

4
pcbnew/exporters/step/step_pcb_model.h

@ -292,8 +292,8 @@ private:
std::vector<TopoDS_Shape> m_board_silkscreen;
std::vector<TopoDS_Shape> m_board_soldermask;
// Data for pads
std::map<wxString, std::pair<gp_Pnt, TopoDS_Shape>> m_pad_points;
// Data for pads. Key example: Pad_F_U2_1_GND
std::map<wxString, std::vector<std::pair<gp_Pnt, TopoDS_Shape>>> m_pad_points;
/// Name of the PCB, which will most likely be the file name of the path.
wxString m_pcbName;

Loading…
Cancel
Save