diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index b89d5b6291..19a46dfbe6 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -330,14 +330,14 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem( PCB_TRACK* track, std::array a{ track, other }; std::array b{ other, track }; std::array a_shape{ trackShape, otherShape.get() }; - + bool has_error = false; for( size_t ii = 0; ii < 2 && !has_error; ++ii ) { std::unique_ptr holeShape; - bool has_hole = b[ii]->Type() == PCB_VIA_T || + bool has_hole = b[ii]->Type() == PCB_VIA_T || ( b[ii]->Type() == PCB_PAD_T && static_cast( b[ii] )->GetDrillSize().x ); // We only test a track item here against an item with a hole. @@ -532,6 +532,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances() reportAux( wxT( "Testing %d tracks & vias..." ), m_board->Tracks().size() ); + std::map freePadsUsageMap; std::map< std::pair, LSET> checkedPairs; for( PCB_TRACK* track : m_board->Tracks() ) @@ -580,6 +581,24 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances() // Visitor: [&]( BOARD_ITEM* other ) -> bool { + if( other->Type() == PCB_PAD_T && static_cast( other )->IsFreePad() ) + { + if( other->GetEffectiveShape( layer )->Collide( trackShape.get() ) ) + { + auto it = freePadsUsageMap.find( other ); + + if( it == freePadsUsageMap.end() ) + { + freePadsUsageMap[ other ] = track->GetNetCode(); + return false; + } + else if( it->second == track->GetNetCode() ) + { + return false; + } + } + } + return testTrackAgainstItem( track, trackShape.get(), layer, other ); }, m_largestClearance );