From 56a531109af71d8613e407635e79ea6c3654be1b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 28 Aug 2020 20:27:44 +0100 Subject: [PATCH] Don't try and shrink shapes generated from pads. It ends up being different from shrinking the final outline. --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 22 +++++++++---------- ...board_items_to_polygon_shape_transform.cpp | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 2303d89be3..7d47a22a06 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -319,13 +319,15 @@ void BOARD_ADAPTER::createNewPadWithClearance( const D_PAD* aPad, { SHAPE_POLY_SET poly; - // 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. + // Our shape-based builder can't handle negative or differing x:y clearance values (the + // former are common for solder paste whiel the later 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 ) + if( ( aClearanceValue.x < 0 || aClearanceValue.x != aClearanceValue.y ) + && aPad->GetShape() != PAD_SHAPE_CUSTOM ) { D_PAD dummy( *aPad ); dummy.SetSize( aPad->GetSize() + aClearanceValue + aClearanceValue ); @@ -459,8 +461,6 @@ void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule int aInflateValue, bool aSkipNPTHPadsWihNoCopper ) { - wxSize margin; - for( D_PAD* pad : aModule->Pads() ) { if( !pad->IsOnLayer( aLayerId ) ) @@ -495,22 +495,22 @@ void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule } } + wxSize margin( aInflateValue, aInflateValue ); + switch( aLayerId ) { case F_Mask: case B_Mask: - margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue; + margin.x += pad->GetSolderMaskMargin(); + margin.y += pad->GetSolderMaskMargin(); break; case F_Paste: case B_Paste: - margin = pad->GetSolderPasteMargin(); - margin.x += aInflateValue; - margin.y += aInflateValue; + margin += pad->GetSolderPasteMargin(); break; default: - margin.x = margin.y = aInflateValue; break; } diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index a674363c7b..af30183b68 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -178,7 +178,8 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( PCB_LAYER_ID aLayer, // 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 ) + if( ( clearance.x < 0 || clearance.x != clearance.y ) + && pad->GetShape() != PAD_SHAPE_CUSTOM ) { D_PAD dummy( *pad ); dummy.SetSize( pad->GetSize() + clearance + clearance );