Better inspection reporting for netclasses, custom rules and DRC.

This commit is contained in:
Jeff Young 2022-04-16 00:57:08 +01:00
parent 250a246761
commit 9ff1ae5bdc
3 changed files with 244 additions and 85 deletions

View File

@ -550,7 +550,12 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
}
else if( rcItem->GetErrorCode() == DRCE_TEXT_HEIGHT
|| rcItem->GetErrorCode() == DRCE_TEXT_THICKNESS
|| rcItem->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG )
|| rcItem->GetErrorCode() == DRCE_DIFF_PAIR_UNCOUPLED_LENGTH_TOO_LONG
|| rcItem->GetErrorCode() == DRCE_TRACK_WIDTH
|| rcItem->GetErrorCode() == DRCE_VIA_DIAMETER
|| rcItem->GetErrorCode() == DRCE_ANNULAR_WIDTH
|| rcItem->GetErrorCode() == DRCE_DRILL_OUT_OF_RANGE
|| rcItem->GetErrorCode() == DRCE_MICROVIA_DRILL_OUT_OF_RANGE )
{
menu.Append( 3, _( "Run constraints resolution tool..." ) );
}

View File

@ -925,30 +925,49 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
case EDGE_CLEARANCE_CONSTRAINT:
case MECHANICAL_CLEARANCE_CONSTRAINT:
case MECHANICAL_HOLE_CLEARANCE_CONSTRAINT:
{
int val = c->constraint.m_Value.Min();
REPORT( wxString::Format( _( "Checking %s clearance: %s." ),
EscapeHTML( c->constraint.GetName() ),
REPORT_VALUE( val ) ) )
REPORT_VALUE( c->constraint.m_Value.Min() ) ) )
break;
}
case DIFF_PAIR_MAX_UNCOUPLED_CONSTRAINT:
{
int val = c->constraint.m_Value.Max();
REPORT( wxString::Format( _( "Checking %s max uncoupled length: %s." ),
EscapeHTML( c->constraint.GetName() ),
REPORT_VALUE( val ) ) )
REPORT_VALUE( c->constraint.m_Value.Max() ) ) )
break;
}
case SKEW_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s max skew: %s." ),
EscapeHTML( c->constraint.GetName() ),
REPORT_VALUE( c->constraint.m_Value.Max() ) ) )
break;
case THERMAL_RELIEF_GAP_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s gap: %s." ),
EscapeHTML( c->constraint.GetName() ),
REPORT_VALUE( c->constraint.m_Value.Min() ) ) )
break;
case THERMAL_SPOKE_WIDTH_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s thermal spoke width: %s." ),
EscapeHTML( c->constraint.GetName() ),
REPORT_VALUE( c->constraint.m_Value.Opt() ) ) )
break;
case ZONE_CONNECTION_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s zone connection: %s." ),
EscapeHTML( c->constraint.GetName() ),
EscapeHTML( PrintZoneConnection( c->constraint.m_ZoneConnection ) ) ) )
break;
case TRACK_WIDTH_CONSTRAINT:
case ANNULAR_WIDTH_CONSTRAINT:
case VIA_DIAMETER_CONSTRAINT:
case HOLE_SIZE_CONSTRAINT:
case TEXT_HEIGHT_CONSTRAINT:
case TEXT_THICKNESS_CONSTRAINT:
case DIFF_PAIR_GAP_CONSTRAINT:
case LENGTH_CONSTRAINT:
{
if( aReporter )
{
@ -959,21 +978,97 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
if( implicit )
{
min = StringFromValue( UNITS, c->constraint.m_Value.Min(), true );
opt = StringFromValue( UNITS, c->constraint.m_Value.Opt(), true );
switch( c->constraint.m_Type )
{
case TRACK_WIDTH_CONSTRAINT: msg = _( "track width" ); break;
case ANNULAR_WIDTH_CONSTRAINT: msg = _( "annular width" ); break;
case VIA_DIAMETER_CONSTRAINT: msg = _( "via diameter" ); break;
case DIFF_PAIR_GAP_CONSTRAINT: msg = _( "diff pair gap" ); break;
default: msg = _( "constraint" ); break;
case TRACK_WIDTH_CONSTRAINT:
if( c->constraint.m_Value.HasOpt() )
{
REPORT( wxString::Format( _( "Checking %s track width: opt %s." ),
EscapeHTML( c->constraint.GetName() ),
opt ) )
}
else if( c->constraint.m_Value.HasMin() )
{
REPORT( wxString::Format( _( "Checking board setup constraints "
"track width: min %s." ),
min ) )
}
REPORT( wxString::Format( _( "Checking %s %s: opt %s." ),
break;
case ANNULAR_WIDTH_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s annular width: min %s." ),
EscapeHTML( c->constraint.GetName() ),
EscapeHTML( msg ),
opt ) )
break;
case VIA_DIAMETER_CONSTRAINT:
if( c->constraint.m_Value.HasOpt() )
{
REPORT( wxString::Format( _( "Checking %s via diameter: opt %s." ),
EscapeHTML( c->constraint.GetName() ),
opt ) )
}
else if( c->constraint.m_Value.HasMin() )
{
REPORT( wxString::Format( _( "Checking board setup constraints "
"via diameter: min %s." ),
min ) )
}
break;
case HOLE_SIZE_CONSTRAINT:
if( c->constraint.m_Value.HasOpt() )
{
REPORT( wxString::Format( _( "Checking %s hole size: opt %s." ),
EscapeHTML( c->constraint.GetName() ),
opt ) )
}
else if( c->constraint.m_Value.HasMin() )
{
REPORT( wxString::Format( _( "Checking board setup constraints "
"hole size: min %s." ),
min ) )
}
break;
case TEXT_HEIGHT_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s: min %s." ),
EscapeHTML( c->constraint.GetName() ),
min ) )
break;
case TEXT_THICKNESS_CONSTRAINT:
REPORT( wxString::Format( _( "Checking %s: min %s." ),
EscapeHTML( c->constraint.GetName() ),
min ) )
break;
case DIFF_PAIR_GAP_CONSTRAINT:
if( c->constraint.m_Value.HasOpt() )
{
REPORT( wxString::Format( _( "Checking %s diff pair gap: "
"opt %s." ),
EscapeHTML( c->constraint.GetName() ),
opt ) )
}
else if( c->constraint.m_Value.HasMin() )
{
REPORT( wxString::Format( _( "Checking board setup constraints "
"clearance: min %s." ),
min ) )
}
break;
default:
REPORT( wxString::Format( _( "Checking %s." ),
EscapeHTML( c->constraint.GetName() ) ) )
}
}
else
{

View File

@ -282,9 +282,8 @@ void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr<RC_ITEM>& aDR
constraint = drcEngine.EvalRules( TEXT_HEIGHT_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved text height constraints: min %s; opt %s; max %s." ),
r->Report( wxString::Format( _( "Resolved height constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportOpt( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
@ -298,9 +297,69 @@ void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr<RC_ITEM>& aDR
constraint = drcEngine.EvalRules( TEXT_THICKNESS_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved text thickness constraints: min %s; opt %s; max %s." ),
r->Report( wxString::Format( _( "Resolved thickness constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
case DRCE_TRACK_WIDTH:
r = m_inspectClearanceDialog->AddPage( _( "Track Width" ) );
reportHeader( _( "Track width resolution for:" ), a, r );
if( compileError )
reportCompileError( r );
constraint = drcEngine.EvalRules( TRACK_WIDTH_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved width constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
case DRCE_VIA_DIAMETER:
r = m_inspectClearanceDialog->AddPage( _( "Via Diameter" ) );
reportHeader( _( "Via diameter resolution for:" ), a, r );
if( compileError )
reportCompileError( r );
constraint = drcEngine.EvalRules( VIA_DIAMETER_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved diameter constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
case DRCE_ANNULAR_WIDTH:
r = m_inspectClearanceDialog->AddPage( _( "Via Annulus" ) );
reportHeader( _( "Via annular width resolution for:" ), a, r );
if( compileError )
reportCompileError( r );
constraint = drcEngine.EvalRules( ANNULAR_WIDTH_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved annular width constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
case DRCE_DRILL_OUT_OF_RANGE:
case DRCE_MICROVIA_DRILL_OUT_OF_RANGE:
r = m_inspectClearanceDialog->AddPage( _( "Hole Size" ) );
reportHeader( _( "Hose diameter resolution for:" ), a, r );
if( compileError )
reportCompileError( r );
constraint = drcEngine.EvalRules( HOLE_SIZE_CONSTRAINT, a, b, layer, r );
r->Report( "" );
r->Report( wxString::Format( _( "Resolved diameter constraints: min %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportOpt( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
break;
@ -990,13 +1049,11 @@ int BOARD_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
if( compileError )
reportCompileError( r );
wxString min = _( "undefined" );
if( constraint.m_Value.HasMin() )
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
r->Report( "" );
r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) );
r->Report( wxString::Format( _( "Diameter constraints: min %s; opt %s; max %s." ),
reportMin( r->GetUnits(), constraint ),
reportOpt( r->GetUnits(), constraint ),
reportMax( r->GetUnits(), constraint ) ) );
r->Flush();
}
@ -1338,6 +1395,7 @@ int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
return 0;
}
#if 0
int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
{
@ -1372,6 +1430,7 @@ int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
}
#endif
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
{
std::string tool = aEvent.GetCommandStr().get();