From 2d5015c21766e81362971a61f04970e3719c118b Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 26 Feb 2021 13:02:45 -0800 Subject: [PATCH] FABMASTER: Try harder to figure out nets Find all intersecting points both forward and back between the filled areas and the outlines in order to determine the proper net assignment for the zones Also creates rule areas for special zones instead of filled zones Fixes https://gitlab.com/kicad/code/kicad/issues/7732 --- pcbnew/plugins/fabmaster/import_fabmaster.cpp | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index 3808238cf4..2a99c0381b 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -1795,7 +1795,7 @@ bool FABMASTER::loadZones( BOARD* aBoard ) for( auto& zone : zones ) { - if( IsCopperLayer( getLayer( zone->layer ) ) ) + if( IsCopperLayer( getLayer( zone->layer ) ) || zone->layer == "ALL" ) loadZone( aBoard, zone ); else { @@ -1856,12 +1856,17 @@ bool FABMASTER::loadZones( BOARD* aBoard ) for( auto& pt1 : outline1.CPoints() ) { - if( !outline2.PointOnEdge( pt1, 1 ) ) - continue; - /// We're looking for the netcode with the most overlaps to the un-netted zone - overlaps[ zone2->GetNetCode() ]++; - break; + if( outline2.PointOnEdge( pt1, 1 ) ) + overlaps[ zone2->GetNetCode() ]++; + } + + for( auto& pt2 : outline2.CPoints() ) + { + /// The overlap between outline1 and outline2 isn't perfect, so look for overlaps + /// in both directions + if( outline1.PointOnEdge( pt2, 1 ) ) + overlaps[ zone2->GetNetCode() ]++; } } @@ -2509,7 +2514,10 @@ bool FABMASTER::loadZone( BOARD* aBoard, const std::unique_ptr if( net_it != netinfo.end() ) zone->SetNet( net_it->second ); - zone->SetLayer( layer ); + if( aLine->layer == "ALL" ) + zone->SetLayerSet( aBoard->GetLayerSet() & LSET::AllCuMask() ); + else + zone->SetLayer( layer ); zone->SetIsRuleArea( false ); zone->SetDoNotAllowTracks( false ); @@ -2518,6 +2526,17 @@ bool FABMASTER::loadZone( BOARD* aBoard, const std::unique_ptr zone->SetDoNotAllowFootprints( false ); zone->SetDoNotAllowCopperPour( false ); + if( aLine->lclass == "ROUTE KEEPOUT") + { + zone->SetIsRuleArea( true ); + zone->SetDoNotAllowTracks( true ); + } + else if( aLine->lclass == "VIA KEEPOUT") + { + zone->SetIsRuleArea( true ); + zone->SetDoNotAllowVias( true ); + } + zone->SetPriority( 50 ); zone->SetLocalClearance( 0 ); zone->SetPadConnection( ZONE_CONNECTION::FULL );