diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 87d9727085..17c51cfcf9 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -342,13 +342,15 @@ public: * Used in filling zones calculations * Circles (vias) and arcs (ends of tracks) are approximated by segments * @param aCornerBuffer = a buffer to store the polygon - * @param aClearanceValue = the clearance around the pad - * @param aAddClearance = true to add a clearance area to the polygon - * false to create the outline polygon. + * @param aMinClearanceValue = the min clearance around outlines + * @param aUseNetClearance = true to use a clearance which is the max value between + * aMinClearanceValue and the net clearance + * false to use aMinClearanceValue only + * if both aMinClearanceValue = 0 and aUseNetClearance = false: create the zone outline polygon. */ void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer, - int aClearanceValue, - bool aAddClearance ); + int aMinClearanceValue, + bool aUseNetClearance ); /** * Function HitTestForCorner * tests if the given wxPoint near a corner diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index a4c22752dc..803f2cc356 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -376,7 +376,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() ) continue; - // A highter priority zone or keepout area is found: remove its area + // A highter priority zone or keepout area is found: remove this area item_boundingbox = zone->GetBoundingBox(); if( !item_boundingbox.Intersects( zone_boundingbox ) ) continue; @@ -386,18 +386,21 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) // do not add clearance. // the zone will be connected to the current zone, but filled areas // will use different parameters (clearance, thermal shapes ) - bool addclearance = GetNetCode() != zone->GetNetCode(); - int clearance = zone_clearance; + bool same_net = GetNetCode() == zone->GetNetCode(); + int min_clearance = zone_clearance; + bool use_net_clearance = true; - if( zone->GetIsKeepout() ) + if( zone->GetIsKeepout() || same_net ) { - addclearance = true; - clearance = m_ZoneMinThickness / 2; + // Just take in account the fact the outline has a thickness, so + // the actual area to substract is inflated to take in account this fact + min_clearance = m_ZoneMinThickness / 2; + use_net_clearance = false; } zone->TransformOutlinesShapeWithClearanceToPolygon( cornerBufferPolysToSubstract, - clearance, addclearance ); + min_clearance, use_net_clearance ); } // Remove thermal symbols diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index 985d0db48f..bdd789bf3a 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -48,22 +48,22 @@ * false to create the outline polygon. */ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon( - CPOLYGONS_LIST& aCornerBuffer, - int aClearanceValue, bool aAddClearance ) + CPOLYGONS_LIST& aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance ) { // Creates the zone outline polygon (with linked holes if any) CPOLYGONS_LIST zoneOutline; BuildFilledSolidAreasPolygons( NULL, &zoneOutline ); // add clearance to outline - int clearance = 0; + int clearance = aMinClearanceValue; - if( aAddClearance ) + if( aUseNetClearance ) { clearance = GetClearance(); - if( aClearanceValue > clearance ) - clearance = aClearanceValue; + if( aMinClearanceValue > clearance ) + clearance = aMinClearanceValue; } + // Calculate the polygon with clearance // holes are linked to the main outline, so only one polygon is created. if( clearance ) diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index b9b23ef76e..e207f35282 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -1501,7 +1501,7 @@ void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWith // If polycount<= 1, there is no holes found, and therefore just copy the polygon. if( polycount <= 1 ) { - aOnePolyList = aPolysListWithHoles; + aOnePolyList.Append( aPolysListWithHoles ); return; }