From c88b43e3562d81dc23e932646656faa944082746 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 27 Aug 2018 18:34:28 +0100 Subject: [PATCH] Don't double-report segments that are too close. --- pcbnew/drc.cpp | 40 ++++++++++--------------- pcbnew/drc.h | 4 +-- pcbnew/drc_clearance_test_functions.cpp | 4 +-- pcbnew/drc_item.cpp | 4 +-- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 73f29726b9..9745142da2 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -275,17 +275,12 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers ) for( auto iterator = refSmoothedPoly.IterateWithHoles(); iterator; iterator++ ) { VECTOR2I currentVertex = *iterator; + wxPoint pt( currentVertex.x, currentVertex.y ); if( testSmoothedPoly.Contains( currentVertex ) ) { - // COPPERAREA_COPPERAREA error: copper area ref corner inside copper area if( aCreateMarkers ) - { - wxPoint pt( currentVertex.x, currentVertex.y ); - auto marker = new MARKER_PCB( units, COPPERAREA_INSIDE_COPPERAREA, - pt, zoneRef, pt, zoneToTest, pt ); - commit.Add( marker ); - } + commit.Add( newMarker( pt, zoneRef, zoneToTest, DRCE_ZONES_INTERSECT ) ); nerrors++; } @@ -295,23 +290,20 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers ) for( auto iterator = testSmoothedPoly.IterateWithHoles(); iterator; iterator++ ) { VECTOR2I currentVertex = *iterator; + wxPoint pt( currentVertex.x, currentVertex.y ); if( refSmoothedPoly.Contains( currentVertex ) ) { - // COPPERAREA_COPPERAREA error: copper area corner inside copper area ref if( aCreateMarkers ) - { - wxPoint pt( currentVertex.x, currentVertex.y ); - auto marker = new MARKER_PCB( units, COPPERAREA_INSIDE_COPPERAREA, - pt, zoneToTest, pt, zoneRef, pt ); - commit.Add( marker ); - } + commit.Add( newMarker( pt, zoneToTest, zoneRef, DRCE_ZONES_INTERSECT ) ); nerrors++; } } // Iterate through all the segments of refSmoothedPoly + std::set conflictPoints; + for( auto refIt = refSmoothedPoly.IterateSegmentsWithHoles(); refIt; refIt++ ) { // Build ref segment @@ -344,19 +336,17 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers ) &pt.x, &pt.y ); if( d < zone2zoneClearance ) - { - // COPPERAREA_COPPERAREA error : intersect or too close - if( aCreateMarkers ) - { - auto marker = new MARKER_PCB( units, COPPERAREA_CLOSE_TO_COPPERAREA, - pt, zoneRef, pt, zoneToTest, pt ); - commit.Add( marker ); - } - - nerrors++; - } + conflictPoints.insert( pt ); } } + + for( wxPoint pt : conflictPoints ) + { + if( aCreateMarkers ) + commit.Add( newMarker( pt, zoneRef, zoneToTest, DRCE_ZONES_TOO_CLOSE ) ); + + nerrors++; + } } } diff --git a/pcbnew/drc.h b/pcbnew/drc.h index 0d3ff270b1..ffd378de62 100644 --- a/pcbnew/drc.h +++ b/pcbnew/drc.h @@ -63,8 +63,8 @@ #define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad #define DRCE_VIA_HOLE_BIGGER 20 ///< via's hole is bigger than its diameter #define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR 21 ///< micro via's layer pair incorrect (layers must be adjacent) -#define COPPERAREA_INSIDE_COPPERAREA 22 ///< copper area outlines intersect -#define COPPERAREA_CLOSE_TO_COPPERAREA 23 ///< copper area outlines are too close +#define DRCE_ZONES_INTERSECT 22 ///< copper area outlines intersect +#define DRCE_ZONES_TOO_CLOSE 23 ///< copper area outlines are too close #define DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE 24 ///< copper area has a net but no pads in nets, which is suspicious #define DRCE_HOLE_NEAR_PAD 25 ///< hole too close to pad #define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index ad0cdb666e..aac4a5387a 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -767,7 +767,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) if( area_to_test->Outline()->Contains( end ) ) { wxPoint pos( end.x, end.y ); - m_currentMarker = newMarker( pos, aArea, area_to_test, COPPERAREA_INSIDE_COPPERAREA ); + m_currentMarker = newMarker( pos, aArea, area_to_test, DRCE_ZONES_INTERSECT ); return false; } @@ -800,7 +800,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex ) { // COPPERAREA_COPPERAREA error : edge intersect or too close m_currentMarker = newMarker( wxPoint( x, y ), aArea, area_to_test, - COPPERAREA_CLOSE_TO_COPPERAREA ); + DRCE_ZONES_TOO_CLOSE ); return false; } diff --git a/pcbnew/drc_item.cpp b/pcbnew/drc_item.cpp index a80604e631..6c71010476 100644 --- a/pcbnew/drc_item.cpp +++ b/pcbnew/drc_item.cpp @@ -77,9 +77,9 @@ wxString DRC_ITEM::GetErrorText() const return wxString( _( "Buried Via: not allowed" ) ); case DRCE_DISABLED_LAYER_ITEM: return wxString( _( "Item on a disabled layer" ) ); - case COPPERAREA_INSIDE_COPPERAREA: + case DRCE_ZONES_INTERSECT: return wxString( _( "Copper area inside copper area" ) ); - case COPPERAREA_CLOSE_TO_COPPERAREA: + case DRCE_ZONES_TOO_CLOSE: return wxString( _( "Copper areas intersect or are too close" ) ); case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE: