Fp editor: add DRC test for through hole pads without hole.
This commit is contained in:
parent
1e1da55840
commit
40e6a9a926
|
@ -133,7 +133,21 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks()
|
|||
m_frame->GetCanvas()->GetView()->Add( marker );
|
||||
};
|
||||
|
||||
const std::function<void( const wxString& msg, const wxPoint& position )> tstHoleInTHPad =
|
||||
[&]( const wxString& aMsg, const wxPoint& aPosition )
|
||||
{
|
||||
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_PAD_TH_WITH_NO_HOLE );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + aMsg );
|
||||
drcItem->SetItems( footprint );
|
||||
|
||||
PCB_MARKER* marker = new PCB_MARKER( drcItem, aPosition );
|
||||
board->Add( marker );
|
||||
m_frame->GetCanvas()->GetView()->Add( marker );
|
||||
};
|
||||
|
||||
footprint->CheckFootprintAttributes( &typeWarning );
|
||||
footprint->CheckFootprintTHPadNoHoles( &tstHoleInTHPad );
|
||||
m_checksRun = true;
|
||||
|
||||
SetMarkersProvider( new BOARD_DRC_ITEMS_PROVIDER( m_frame->GetBoard() ) );
|
||||
|
|
|
@ -206,6 +206,11 @@ DRC_ITEM DRC_ITEM::footprintTypeMismatch( DRCE_FOOTPRINT_TYPE_MISMATCH,
|
|||
_( "Footprint type doesn't match footprint pads" ),
|
||||
wxT( "footprint_type_mismatch" ) );
|
||||
|
||||
DRC_ITEM DRC_ITEM::footprintTHPadhasNoHole( DRCE_PAD_TH_WITH_NO_HOLE,
|
||||
_( "Through hole pad has no hole" ),
|
||||
wxT( "through_hole_pad_without_hole" ) );
|
||||
|
||||
|
||||
std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
|
||||
DRC_ITEM::heading_electrical,
|
||||
DRC_ITEM::shortingItems,
|
||||
|
@ -253,7 +258,8 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
|
|||
DRC_ITEM::itemOnDisabledLayer,
|
||||
DRC_ITEM::unresolvedVariable,
|
||||
|
||||
DRC_ITEM::footprintTypeMismatch
|
||||
DRC_ITEM::footprintTypeMismatch,
|
||||
DRC_ITEM::footprintTHPadhasNoHole
|
||||
} );
|
||||
|
||||
|
||||
|
@ -301,6 +307,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
|
|||
case DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( diffPairGapOutOfRange );
|
||||
case DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG: return std::make_shared<DRC_ITEM>( diffPairUncoupledLengthTooLong );
|
||||
case DRCE_FOOTPRINT_TYPE_MISMATCH: return std::make_shared<DRC_ITEM>( footprintTypeMismatch );
|
||||
case DRCE_PAD_TH_WITH_NO_HOLE: return std::make_shared<DRC_ITEM>( footprintTHPadhasNoHole );
|
||||
default:
|
||||
wxFAIL_MSG( "Unknown DRC error code" );
|
||||
return nullptr;
|
||||
|
|
|
@ -68,6 +68,7 @@ enum PCB_DRC_CODE {
|
|||
DRCE_NET_CONFLICT, // pad net doesn't match netlist
|
||||
|
||||
DRCE_FOOTPRINT_TYPE_MISMATCH, // footprint attribute does not match actual pads
|
||||
DRCE_PAD_TH_WITH_NO_HOLE, // footprint has Plated Through-Hole with no hole
|
||||
|
||||
DRCE_UNRESOLVED_VARIABLE,
|
||||
DRCE_SILK_MASK_CLEARANCE, // silkscreen clipped by mask (potentially leaving it
|
||||
|
@ -172,6 +173,7 @@ private:
|
|||
static DRC_ITEM diffPairGapOutOfRange;
|
||||
static DRC_ITEM diffPairUncoupledLengthTooLong;
|
||||
static DRC_ITEM footprintTypeMismatch;
|
||||
static DRC_ITEM footprintTHPadhasNoHole;
|
||||
|
||||
private:
|
||||
DRC_RULE* m_violatingRule = nullptr;
|
||||
|
|
|
@ -2105,6 +2105,30 @@ void FOOTPRINT::CheckFootprintAttributes( const std::function<void( const wxStri
|
|||
}
|
||||
}
|
||||
|
||||
void FOOTPRINT::CheckFootprintTHPadNoHoles(
|
||||
const std::function<void( const wxString& msg, const wxPoint& position )>*
|
||||
aErrorHandler )
|
||||
{
|
||||
if( aErrorHandler == nullptr )
|
||||
return;
|
||||
|
||||
for( const PAD* pad: Pads() )
|
||||
{
|
||||
|
||||
if( pad->GetAttribute() != PAD_ATTRIB::PTH
|
||||
&& pad->GetAttribute() != PAD_ATTRIB::NPTH )
|
||||
continue;
|
||||
|
||||
if( pad->GetDrillSizeX() < 1 || pad->GetDrillSizeX() < 1 )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "(pad \"%s\")" ), pad->GetNumber() );
|
||||
|
||||
(*aErrorHandler)( msg, pad->GetPosition() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT::SwapData( BOARD_ITEM* aImage )
|
||||
{
|
||||
|
|
|
@ -354,6 +354,20 @@ public:
|
|||
*/
|
||||
void CheckFootprintAttributes( const std::function<void( const wxString& msg )>* aErrorHandler );
|
||||
|
||||
/**
|
||||
* Test if footprint attributes for type (SMD/Through hole/Other) match the expected
|
||||
* type based on the pads in the footprint.
|
||||
* Footprints with plated through-hole pads should usually be marked through hole even if they also
|
||||
* have SMD because they might not be auto-placed. Exceptions to this might be shielded connectors
|
||||
* Otherwise, footprints with SMD pads should be marked SMD
|
||||
* Footprints with no connecting pads should be marked "Other"
|
||||
*
|
||||
* @param aErrorHandler callback to handle the error messages generated
|
||||
*/
|
||||
void CheckFootprintTHPadNoHoles( const std::function
|
||||
<void( const wxString& msg, const wxPoint& position )>*
|
||||
aErrorHandler );
|
||||
|
||||
/**
|
||||
* Generate pads shapes on layer \a aLayer as polygons and adds these polygons to
|
||||
* \a aCornerBuffer.
|
||||
|
|
Loading…
Reference in New Issue