When inflating dummy pad make sure to reset clearance to zero.

And, the inflate-dummy-pad hack doesn't work for custom pad shapes,
so turn it off there.

Fixes https://gitlab.com/kicad/code/kicad/issues/5363
This commit is contained in:
Jeff Young 2020-08-27 18:13:08 +01:00
parent 9e12ea9bb6
commit 2c4269d03e
1 changed files with 10 additions and 5 deletions

View File

@ -319,18 +319,23 @@ void BOARD_ADAPTER::createNewPadWithClearance( const D_PAD* aPad,
{ {
SHAPE_POLY_SET poly; SHAPE_POLY_SET poly;
if( aClearanceValue.x != aClearanceValue.y ) // Our shape-based builder 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 general-purpose polygon builder 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 aClearanceValue.x.
if( aClearanceValue.x != aClearanceValue.y && aPad->GetShape() != PAD_SHAPE_CUSTOM )
{ {
// Our shape-based builder can't handle differing x:y clearance values (which
// get generated when relative paste margin is used with an oblong pad). So
// we fake a larger pad and run the general-purpose polygon builder on it.
D_PAD dummy( *aPad ); D_PAD dummy( *aPad );
dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue ); dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue );
dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0 ); dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0 );
aClearanceValue = { 0, 0 };
} }
else else
{ {
auto padShapes = std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() ); auto padShapes = std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
for( const SHAPE* shape : padShapes->Shapes() ) for( const SHAPE* shape : padShapes->Shapes() )
{ {
switch( shape->Type() ) switch( shape->Type() )
@ -456,7 +461,7 @@ void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule
{ {
wxSize margin; wxSize margin;
for( auto pad : aModule->Pads() ) for( D_PAD* pad : aModule->Pads() )
{ {
if( !pad->IsOnLayer( aLayerId ) ) if( !pad->IsOnLayer( aLayerId ) )
continue; continue;