Ensure that we check tracks exiting pads for gaps

The DP gap check should look for sections of track that are coupled by
wider than a given spacing.  Our primitive check of looking for
collisions on the segment between the start poins causes tracks exiting
but not entering pads to be excluded.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21561
This commit is contained in:
Seth Hillbrand 2025-08-26 12:38:22 -07:00
parent 0a767acb3a
commit 1e76f1a11d

View File

@ -22,6 +22,7 @@
#include <board.h> #include <board.h>
#include <board_design_settings.h> #include <board_design_settings.h>
#include <pcb_track.h> #include <pcb_track.h>
#include <pad.h>
#include <pcb_generator.h> #include <pcb_generator.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <drc/drc_test_provider.h> #include <drc/drc_test_provider.h>
@ -361,6 +362,24 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp )
return false; return false;
} }
} }
else if( aItem->Type() == PCB_PAD_T )
{
PAD* pad = static_cast<PAD*>( aItem );
auto trackExitsPad = [&]( PCB_TRACK* track )
{
bool startIn = pad->HitTest( track->GetStart(), 0 );
bool endIn = pad->HitTest( track->GetEnd(), 0 );
return startIn ^ endIn;
};
if( trackExitsPad( static_cast<PCB_TRACK*>( coupled->parentP ) )
|| trackExitsPad( static_cast<PCB_TRACK*>( coupled->parentN ) ) )
{
return false;
}
}
return true; return true;
}; };
@ -438,6 +457,24 @@ static void extractDiffPairCoupledItems( DIFF_PAIR_ITEMS& aDp )
return false; return false;
} }
} }
else if( aItem->Type() == PCB_PAD_T )
{
PAD* pad = static_cast<PAD*>( aItem );
auto arcExitsPad = [&]( PCB_ARC* arc )
{
bool startIn = pad->HitTest( arc->GetStart(), 0 );
bool endIn = pad->HitTest( arc->GetEnd(), 0 );
return startIn ^ endIn;
};
if( arcExitsPad( static_cast<PCB_ARC*>( coupled->parentP ) )
|| arcExitsPad( static_cast<PCB_ARC*>( coupled->parentN ) ) )
{
return false;
}
}
return true; return true;
}; };