Check parent footprint as well for component class.

Also output more descriptive text when checking inherited
rules on parent footprint.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20281
This commit is contained in:
Jeff Young 2025-03-10 13:31:38 +00:00
parent a4893523e4
commit d92f42cdcb
3 changed files with 16 additions and 6 deletions

View File

@ -1349,8 +1349,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
{
std::vector<DRC_ENGINE_CONSTRAINT*>* ruleset = m_constraintMap[ aConstraintType ];
for( int ii = 0; ii < (int) ruleset->size(); ++ii )
processConstraint( ruleset->at( ii ) );
for( DRC_ENGINE_CONSTRAINT* rule : *ruleset )
processConstraint( rule );
}
if( constraint.GetParentRule() && !constraint.GetParentRule()->m_Implicit )
@ -1364,6 +1364,10 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|| aConstraintType == THERMAL_RELIEF_GAP_CONSTRAINT
|| aConstraintType == THERMAL_SPOKE_WIDTH_CONSTRAINT ) )
{
REPORT( "" )
REPORT( wxString::Format( _( "Inheriting from parent: %s." ),
EscapeHTML( parentFootprint->GetItemDescription( this, true ) ) ) )
if( a == pad )
a = parentFootprint;
else
@ -1373,8 +1377,8 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
{
std::vector<DRC_ENGINE_CONSTRAINT*>* ruleset = m_constraintMap[ aConstraintType ];
for( int ii = 0; ii < (int) ruleset->size(); ++ii )
processConstraint( ruleset->at( ii ) );
for( DRC_ENGINE_CONSTRAINT* rule : *ruleset )
processConstraint( rule );
if( constraint.GetParentRule() && !constraint.GetParentRule()->m_Implicit )
return constraint;

View File

@ -1263,7 +1263,12 @@ static void hasComponentClassFunc( LIBEVAL::CONTEXT* aCtx, void* self )
result->SetDeferredEval(
[item, arg]() -> double
{
FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( item );
FOOTPRINT* footprint = nullptr;
if( item->Type() == PCB_FOOTPRINT_T )
footprint = static_cast<FOOTPRINT*>( item );
else
footprint = item->GetParentFootprint();
if( !footprint )
return 0.0;

View File

@ -302,7 +302,8 @@ wxString BOARD_INSPECTION_TOOL::InspectDRCErrorMenuText( const std::shared_ptr<R
if( aDRCItem->GetErrorCode() == DRCE_CLEARANCE
|| aDRCItem->GetErrorCode() == DRCE_EDGE_CLEARANCE
|| aDRCItem->GetErrorCode() == DRCE_HOLE_CLEARANCE
|| aDRCItem->GetErrorCode() == DRCE_DRILLED_HOLES_TOO_CLOSE )
|| aDRCItem->GetErrorCode() == DRCE_DRILLED_HOLES_TOO_CLOSE
|| aDRCItem->GetErrorCode() == DRCE_STARVED_THERMAL )
{
return menuDescription( PCB_ACTIONS::inspectClearance );
}