7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 23:31:40 +00:00

OCCT (STEP) export: fuse pad shapes earlier.

Because OCCT doesn't like fusing track segments with 3-part TH pads sometimes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18799
This commit is contained in:
Alex Shvartzkop 2024-10-06 12:28:29 +03:00
parent 646d10b3c6
commit 1b540752d9

View File

@ -781,7 +781,8 @@ STEP_PCB_MODEL::~STEP_PCB_MODEL()
bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool aVia )
{
bool success = true;
bool success = true;
std::vector<TopoDS_Shape> padShapes;
for( PCB_LAYER_ID pcb_layer : aPad->GetLayerSet().Seq() )
{
@ -812,8 +813,7 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
SHAPE_POLY_SET polySet;
aPad->TransformShapeToPolygon( polySet, pcb_layer, 0, ARC_HIGH_DEF, ERROR_INSIDE );
success &= MakeShapes( m_board_copper_pads, polySet, m_simplifyShapes, thickness, Zpos,
aOrigin );
success &= MakeShapes( padShapes, polySet, m_simplifyShapes, thickness, Zpos, aOrigin );
if( testShape.IsNull() )
{
@ -867,7 +867,7 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
if( MakeShapeAsThickSegment( plating, seg_hole->GetSeg().A, seg_hole->GetSeg().B, width,
( top - bottom ), bottom, aOrigin ) )
{
m_board_copper_pads.push_back( plating );
padShapes.push_back( plating );
}
else
{
@ -875,9 +875,25 @@ bool STEP_PCB_MODEL::AddPadShape( const PAD* aPad, const VECTOR2D& aOrigin, bool
}
}
if( !success ) // Error
if( !success ) // Error
ReportMessage( wxT( "OCC error adding pad/via polygon.\n" ) );
// Fuse pad shapes here before fusing them with tracks because OCCT sometimes has trouble
if( m_fuseShapes )
{
TopTools_ListOfShape padShapesList;
for( const TopoDS_Shape& shape : padShapes )
padShapesList.Append( shape );
m_board_copper_pads.push_back( fuseShapesOrCompound( padShapesList ) );
}
else
{
for( const TopoDS_Shape& shape : padShapes )
m_board_copper_pads.push_back( shape );
}
return success;
}