From 2c4269d03e787f8f1fd8c509bb3831e257aca00f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 27 Aug 2020 18:13:08 +0100 Subject: [PATCH] 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 --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 6e0bc4ee3f..2303d89be3 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -319,18 +319,23 @@ void BOARD_ADAPTER::createNewPadWithClearance( const D_PAD* aPad, { 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 ); dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue ); dummy.TransformShapeWithClearanceToPolygon( poly, aLayer, 0 ); + aClearanceValue = { 0, 0 }; } else { auto padShapes = std::static_pointer_cast( aPad->GetEffectiveShape() ); + for( const SHAPE* shape : padShapes->Shapes() ) { switch( shape->Type() ) @@ -456,7 +461,7 @@ void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule { wxSize margin; - for( auto pad : aModule->Pads() ) + for( D_PAD* pad : aModule->Pads() ) { if( !pad->IsOnLayer( aLayerId ) ) continue;