Allow specifying a minimum for a via_count constraint
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17234
This commit is contained in:
parent
b8f4bef3f8
commit
3a3ceb8ffc
|
@ -237,8 +237,9 @@ DRC_ITEM DRC_ITEM::skewOutOfRange( DRCE_SKEW_OUT_OF_RANGE,
|
|||
_( "Skew between traces out of range" ),
|
||||
wxT( "skew_out_of_range" ) );
|
||||
|
||||
DRC_ITEM DRC_ITEM::tooManyVias( DRCE_TOO_MANY_VIAS,
|
||||
_( "Too many vias on a connection" ),
|
||||
// Note: this used to only check against a max value, hence the settings key too_many_vias
|
||||
DRC_ITEM DRC_ITEM::viaCountOutOfRange( DRCE_VIA_COUNT_OUT_OF_RANGE,
|
||||
_( "Too many or too few vias on a connection" ),
|
||||
wxT( "too_many_vias" ) );
|
||||
|
||||
DRC_ITEM DRC_ITEM::diffPairGapOutOfRange( DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE,
|
||||
|
@ -298,7 +299,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes( {
|
|||
DRC_ITEM::heading_signal_integrity,
|
||||
DRC_ITEM::lengthOutOfRange,
|
||||
DRC_ITEM::skewOutOfRange,
|
||||
DRC_ITEM::tooManyVias,
|
||||
DRC_ITEM::viaCountOutOfRange,
|
||||
DRC_ITEM::diffPairGapOutOfRange,
|
||||
DRC_ITEM::diffPairUncoupledLengthTooLong,
|
||||
|
||||
|
@ -378,7 +379,7 @@ std::shared_ptr<DRC_ITEM> DRC_ITEM::Create( int aErrorCode )
|
|||
case DRCE_TEXT_THICKNESS: return std::make_shared<DRC_ITEM>( textThicknessOutOfRange );
|
||||
case DRCE_LENGTH_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( lengthOutOfRange );
|
||||
case DRCE_SKEW_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( skewOutOfRange );
|
||||
case DRCE_TOO_MANY_VIAS: return std::make_shared<DRC_ITEM>( tooManyVias );
|
||||
case DRCE_VIA_COUNT_OUT_OF_RANGE: return std::make_shared<DRC_ITEM>( viaCountOutOfRange );
|
||||
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: return std::make_shared<DRC_ITEM>( footprint );
|
||||
|
|
|
@ -95,7 +95,7 @@ enum PCB_DRC_CODE {
|
|||
|
||||
DRCE_LENGTH_OUT_OF_RANGE,
|
||||
DRCE_SKEW_OUT_OF_RANGE,
|
||||
DRCE_TOO_MANY_VIAS,
|
||||
DRCE_VIA_COUNT_OUT_OF_RANGE,
|
||||
DRCE_DIFF_PAIR_GAP_OUT_OF_RANGE,
|
||||
DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG,
|
||||
|
||||
|
@ -202,7 +202,7 @@ private:
|
|||
static DRC_ITEM textThicknessOutOfRange;
|
||||
static DRC_ITEM lengthOutOfRange;
|
||||
static DRC_ITEM skewOutOfRange;
|
||||
static DRC_ITEM tooManyVias;
|
||||
static DRC_ITEM viaCountOutOfRange;
|
||||
static DRC_ITEM diffPairGapOutOfRange;
|
||||
static DRC_ITEM diffPairUncoupledLengthTooLong;
|
||||
static DRC_ITEM footprint;
|
||||
|
|
|
@ -201,16 +201,31 @@ void DRC_TEST_PROVIDER_MATCHED_LENGTH::checkViaCounts( const DRC_CONSTRAINT& aCo
|
|||
{
|
||||
for( const auto& ent : aMatchedConnections )
|
||||
{
|
||||
std::shared_ptr<DRC_ITEM> drcItem = nullptr;
|
||||
|
||||
if( aConstraint.GetValue().HasMax() && ent.viaCount > aConstraint.GetValue().Max() )
|
||||
{
|
||||
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_TOO_MANY_VIAS );
|
||||
drcItem = DRC_ITEM::Create( DRCE_VIA_COUNT_OUT_OF_RANGE );
|
||||
wxString msg = wxString::Format( _( "(%s max count %d; actual %d)" ),
|
||||
aConstraint.GetName(),
|
||||
aConstraint.GetValue().Max(),
|
||||
ent.viaCount );
|
||||
|
||||
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
||||
drcItem->SetErrorMessage( _( "Too many vias on a connection" ) + wxS( " " ) + msg );
|
||||
}
|
||||
else if( aConstraint.GetValue().HasMin() && ent.viaCount < aConstraint.GetValue().Min() )
|
||||
{
|
||||
drcItem = DRC_ITEM::Create( DRCE_VIA_COUNT_OUT_OF_RANGE );
|
||||
wxString msg = wxString::Format( _( "(%s min count %d; actual %d)" ),
|
||||
aConstraint.GetName(),
|
||||
aConstraint.GetValue().Min(),
|
||||
ent.viaCount );
|
||||
|
||||
drcItem->SetErrorMessage( _( "Too few vias on a connection" ) + wxS( " " ) + msg );
|
||||
}
|
||||
|
||||
if( drcItem )
|
||||
{
|
||||
for( auto offendingTrack : ent.items )
|
||||
drcItem->SetItems( offendingTrack );
|
||||
|
||||
|
|
Loading…
Reference in New Issue