7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-02 00:26:45 +00:00

Check silk/soldermask collisions in FP checker.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19707
This commit is contained in:
Jeff Young 2025-03-14 19:44:52 +00:00
parent be183c94c0
commit 1ee3131e4a
3 changed files with 47 additions and 0 deletions

View File

@ -188,6 +188,12 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks()
} );
}
footprint->CheckClippedSilk(
[&]( BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const VECTOR2I& aPt )
{
errorHandler( aItemA, aItemB, nullptr, DRCE_SILK_CLEARANCE, wxEmptyString, aPt );
} );
m_checksRun = true;
m_markersTreeModel->Update( m_markersProvider, m_severities );

View File

@ -3491,6 +3491,44 @@ void FOOTPRINT::CheckNetTiePadGroups( const std::function<void( const wxString&
}
void FOOTPRINT::CheckClippedSilk( const std::function<void( BOARD_ITEM* aItemA,
BOARD_ITEM* aItemB,
const VECTOR2I& aPt )>& aErrorHandler )
{
auto checkColliding =
[&]( BOARD_ITEM* item, BOARD_ITEM* other )
{
for( PCB_LAYER_ID silk : { F_SilkS, B_SilkS } )
{
PCB_LAYER_ID mask = silk == F_SilkS ? F_Mask : B_Mask;
if( !item->IsOnLayer( silk ) || !other->IsOnLayer( mask ) )
continue;
std::shared_ptr<SHAPE> itemShape = item->GetEffectiveShape( silk );
std::shared_ptr<SHAPE> otherShape = other->GetEffectiveShape( mask );
int actual;
VECTOR2I pos;
if( itemShape->Collide( otherShape.get(), 0, &actual, &pos ) )
aErrorHandler( item, other, pos );
}
};
for( BOARD_ITEM* item : m_drawings )
{
for( BOARD_ITEM* other : m_drawings )
{
if( other != item )
checkColliding( item, other );
}
for( PAD* pad : m_pads )
checkColliding( item, pad );
}
}
void FOOTPRINT::swapData( BOARD_ITEM* aImage )
{
wxASSERT( aImage->Type() == PCB_FOOTPRINT_T );

View File

@ -498,6 +498,9 @@ public:
*/
void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
void CheckClippedSilk( const std::function<void( BOARD_ITEM* aItemA,
BOARD_ITEM* aItemB,
const VECTOR2I& aPt )>& aErrorHandler );
/**
* Cache the pads that are allowed to connect to each other in the footprint.
*/