From 099fcf1247593a499026372eb3b26eb662fa730d Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Tue, 31 Jul 2018 22:33:53 +0200 Subject: [PATCH] ZONE_CREATE_HELPER: fix zone cutout creation in zones with holes, reinit selection with the resulting zone Fixes: lp:1784268 * https://bugs.launchpad.net/kicad/+bug/1784268 --- pcbnew/tools/zone_create_helper.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index 0f9c2f2adf..05668e6e5d 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -117,7 +117,6 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE std::vector newZones; SHAPE_POLY_SET originalOutline( *aZone.Outline() ); - originalOutline.BooleanSubtract( *aCutout.Outline(), SHAPE_POLY_SET::PM_FAST ); for( int i = 0; i < originalOutline.OutlineCount(); i++ ) @@ -125,6 +124,11 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE auto newZoneOutline = new SHAPE_POLY_SET; newZoneOutline->AddOutline( originalOutline.Outline( i ) ); + for (int j = 0; j < originalOutline.HoleCount(i) ; j++ ) + { + newZoneOutline->AddHole( originalOutline.CHole(i, j), i ); + } + auto newZone = new ZONE_CONTAINER( aZone ); newZone->SetOutline( newZoneOutline ); newZone->SetLocalFlags( 1 ); @@ -138,6 +142,11 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINE ZONE_FILLER filler( board ); filler.Fill( newZones ); + + auto toolMgr = m_tool.GetManager(); + + toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); + toolMgr->RunAction( PCB_ACTIONS::selectItem, true, newZones[0] ); }