Handle differential x:y clearance for solder mask.
Fixes https://gitlab.com/kicad/code/kicad/issues/5363
This commit is contained in:
parent
5c67ee6c9d
commit
ebb9a636fa
|
@ -896,8 +896,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddPadsShapesWithClearanceToContainer(
|
AddPadsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0,
|
||||||
module, layerContainer, curr_layer_id, 0, false );
|
false );
|
||||||
}
|
}
|
||||||
|
|
||||||
AddGraphicsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0 );
|
AddGraphicsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0 );
|
||||||
|
|
|
@ -116,7 +116,8 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
|
||||||
|
|
||||||
|
|
||||||
void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
|
void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aMaxError,
|
SHAPE_POLY_SET& aCornerBuffer,
|
||||||
|
int aInflateValue, int aMaxError,
|
||||||
bool aSkipNPTHPadsWihNoCopper ) const
|
bool aSkipNPTHPadsWihNoCopper ) const
|
||||||
{
|
{
|
||||||
for( D_PAD* pad : m_pads )
|
for( D_PAD* pad : m_pads )
|
||||||
|
@ -151,27 +152,43 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize margin;
|
wxSize clearance( aInflateValue, aInflateValue );
|
||||||
int clearance = aInflateValue;
|
|
||||||
|
|
||||||
switch( aLayer )
|
switch( aLayer )
|
||||||
{
|
{
|
||||||
case F_Mask:
|
case F_Mask:
|
||||||
case B_Mask:
|
case B_Mask:
|
||||||
clearance += pad->GetSolderMaskMargin();
|
clearance.x += pad->GetSolderMaskMargin();
|
||||||
|
clearance.y += pad->GetSolderMaskMargin();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_Paste:
|
case F_Paste:
|
||||||
case B_Paste:
|
case B_Paste:
|
||||||
margin = pad->GetSolderPasteMargin();
|
clearance += pad->GetSolderPasteMargin();
|
||||||
clearance += ( margin.x + margin.y ) / 2;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pad->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, clearance );
|
// Our standard TransformShapeWithClearanceToPolygon() routines can't handle differing
|
||||||
|
// x:y clearance values (which get generated when a relative paste margin is used with
|
||||||
|
// an oblong pad). So we apply this huge hack and fake a larger pad to run the transform
|
||||||
|
// on.
|
||||||
|
// Of course being a hack it falls down when dealing with custom shape pads (where the
|
||||||
|
// size is only the size of the anchor), so for those we punt and just use clearance.x.
|
||||||
|
|
||||||
|
if( clearance.x != clearance.y && pad->GetShape() != PAD_SHAPE_CUSTOM )
|
||||||
|
{
|
||||||
|
D_PAD dummy( *pad );
|
||||||
|
dummy.SetSize( pad->GetSize() + clearance + clearance );
|
||||||
|
dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0, aMaxError );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pad->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, clearance.x,
|
||||||
|
aMaxError );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue