Add messages for clearance reports on footprints.
Fixes https://gitlab.com/kicad/code/kicad/issues/13874
This commit is contained in:
parent
28028c941e
commit
77639a540b
|
@ -601,7 +601,45 @@ int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
||||||
b = *bg->GetItems().begin();
|
b = *bg->GetItems().begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// a and b could be null after group tests above.
|
// a or b could be null after group tests above.
|
||||||
|
wxCHECK( a && b, 0 );
|
||||||
|
|
||||||
|
auto checkFootprint =
|
||||||
|
[&]( FOOTPRINT* footprint ) -> BOARD_ITEM*
|
||||||
|
{
|
||||||
|
if( footprint->Pads().empty() )
|
||||||
|
{
|
||||||
|
m_frame->ShowInfoBarError( _( "Cannot generate clearance report on footprint "
|
||||||
|
"with no pads." ) );
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
PAD* foundPad = nullptr;
|
||||||
|
|
||||||
|
for( PAD* pad : footprint->Pads() )
|
||||||
|
{
|
||||||
|
if( !foundPad || pad->SameLogicalPadAs( foundPad ) )
|
||||||
|
{
|
||||||
|
foundPad = pad;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_frame->ShowInfoBarError( _( "Cannot generate clearance report on footprint "
|
||||||
|
"with multiple pads. Select a single pad." ) );
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return foundPad;
|
||||||
|
};
|
||||||
|
|
||||||
|
if( a->Type() == PCB_FOOTPRINT_T )
|
||||||
|
a = checkFootprint( static_cast<FOOTPRINT*>( a ) );
|
||||||
|
|
||||||
|
if( b->Type() == PCB_FOOTPRINT_T )
|
||||||
|
b = checkFootprint( static_cast<FOOTPRINT*>( b ) );
|
||||||
|
|
||||||
|
// a or b could be null after footprint tests above.
|
||||||
wxCHECK( a && b, 0 );
|
wxCHECK( a && b, 0 );
|
||||||
|
|
||||||
DIALOG_BOOK_REPORTER* dialog = m_frame->GetInspectClearanceDialog();
|
DIALOG_BOOK_REPORTER* dialog = m_frame->GetInspectClearanceDialog();
|
||||||
|
|
Loading…
Reference in New Issue