Allow clearance debugging of exact items in DRC violation.
ADDED: Run clearance resolution tool... RMB menu item to DRC clearance errors. Fixes https://gitlab.com/kicad/code/kicad/issues/8438
This commit is contained in:
parent
e93e9fa3e5
commit
3de60231db
|
@ -41,6 +41,7 @@
|
||||||
#include <dialogs/wx_html_report_box.h>
|
#include <dialogs/wx_html_report_box.h>
|
||||||
#include <dialogs/panel_setup_rules_base.h>
|
#include <dialogs/panel_setup_rules_base.h>
|
||||||
#include <tools/drc_tool.h>
|
#include <tools/drc_tool.h>
|
||||||
|
#include <tools/board_inspection_tool.h>
|
||||||
#include <kiplatform/ui.h>
|
#include <kiplatform/ui.h>
|
||||||
|
|
||||||
DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
||||||
|
@ -441,6 +442,12 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
|
wxString::Format( _( "It will be excluded from the %s list" ), listName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( rcItem->GetErrorCode() == DRCE_CLEARANCE
|
||||||
|
|| rcItem->GetErrorCode() == DRCE_COPPER_EDGE_CLEARANCE )
|
||||||
|
{
|
||||||
|
menu.Append( 3, _( "Run clearance resolution tool..." ) );
|
||||||
|
}
|
||||||
|
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
|
|
||||||
if( bds().m_DRCSeverities[ rcItem->GetErrorCode() ] == RPT_SEVERITY_WARNING )
|
if( bds().m_DRCSeverities[ rcItem->GetErrorCode() ] == RPT_SEVERITY_WARNING )
|
||||||
|
@ -448,24 +455,24 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
msg.Printf( _( "Change severity to Error for all '%s' violations" ),
|
msg.Printf( _( "Change severity to Error for all '%s' violations" ),
|
||||||
rcItem->GetErrorText(),
|
rcItem->GetErrorText(),
|
||||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
||||||
menu.Append( 3, msg );
|
menu.Append( 4, msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Change severity to Warning for all '%s' violations" ),
|
msg.Printf( _( "Change severity to Warning for all '%s' violations" ),
|
||||||
rcItem->GetErrorText(),
|
rcItem->GetErrorText(),
|
||||||
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
_( "Violation severities can also be edited in the Board Setup... dialog" ) );
|
||||||
menu.Append( 4, msg );
|
menu.Append( 5, msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Printf( _( "Ignore all '%s' violations" ),
|
msg.Printf( _( "Ignore all '%s' violations" ),
|
||||||
rcItem->GetErrorText(),
|
rcItem->GetErrorText(),
|
||||||
_( "Violations will not be checked or reported" ) );
|
_( "Violations will not be checked or reported" ) );
|
||||||
menu.Append( 5, msg );
|
menu.Append( 6, msg );
|
||||||
|
|
||||||
menu.AppendSeparator();
|
menu.AppendSeparator();
|
||||||
|
|
||||||
menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Board Setup... dialog" ) );
|
menu.Append( 7, _( "Edit violation severities..." ), _( "Open the Board Setup... dialog" ) );
|
||||||
|
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
|
@ -508,6 +515,15 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
{
|
||||||
|
TOOL_MANAGER* toolMgr = m_frame->GetToolManager();
|
||||||
|
BOARD_INSPECTION_TOOL* inspectionTool = toolMgr->GetTool<BOARD_INSPECTION_TOOL>();
|
||||||
|
|
||||||
|
inspectionTool->InspectDRCError( node->m_RcItem );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_ERROR;
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_ERROR;
|
||||||
|
|
||||||
for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() )
|
for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() )
|
||||||
|
@ -521,7 +537,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
modified = true;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 5:
|
||||||
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_WARNING;
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_WARNING;
|
||||||
|
|
||||||
for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() )
|
for( PCB_MARKER* marker : m_frame->GetBoard()->Markers() )
|
||||||
|
@ -535,7 +551,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
modified = true;
|
modified = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 6:
|
||||||
{
|
{
|
||||||
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
|
bds().m_DRCSeverities[ rcItem->GetErrorCode() ] = RPT_SEVERITY_IGNORE;
|
||||||
|
|
||||||
|
@ -558,7 +574,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 7:
|
||||||
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
m_frame->ShowBoardSetupDialog( _( "Violation Severity" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "board_inspection_tool.h"
|
#include "board_inspection_tool.h"
|
||||||
#include <pcbnew_settings.h>
|
#include <pcbnew_settings.h>
|
||||||
#include <widgets/appearance_controls.h>
|
#include <widgets/appearance_controls.h>
|
||||||
|
#include <drc/drc_item.h>
|
||||||
|
|
||||||
void DIALOG_INSPECTION_REPORTER::OnErrorLinkClicked( wxHtmlLinkEvent& event )
|
void DIALOG_INSPECTION_REPORTER::OnErrorLinkClicked( wxHtmlLinkEvent& event )
|
||||||
{
|
{
|
||||||
|
@ -254,6 +254,91 @@ void BOARD_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_T aClearanceType, PC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr<RC_ITEM>& aDRCItem )
|
||||||
|
{
|
||||||
|
BOARD_ITEM* a = m_frame->GetBoard()->GetItem( aDRCItem->GetMainItemID() );
|
||||||
|
BOARD_ITEM* b = m_frame->GetBoard()->GetItem( aDRCItem->GetAuxItemID() );
|
||||||
|
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
|
||||||
|
|
||||||
|
if( !a || !b )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( m_inspectClearanceDialog == nullptr )
|
||||||
|
{
|
||||||
|
m_inspectClearanceDialog = std::make_unique<DIALOG_INSPECTION_REPORTER>( m_frame );
|
||||||
|
m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
|
||||||
|
|
||||||
|
m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
|
||||||
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
|
||||||
|
nullptr, this );
|
||||||
|
}
|
||||||
|
|
||||||
|
WX_HTML_REPORT_BOX* r = m_inspectClearanceDialog->m_Reporter;
|
||||||
|
r->SetUnits( m_frame->GetUserUnits() );
|
||||||
|
r->Clear();
|
||||||
|
|
||||||
|
switch( aDRCItem->GetErrorCode() )
|
||||||
|
{
|
||||||
|
case DRCE_COPPER_EDGE_CLEARANCE:
|
||||||
|
r->Report( "<h7>" + _( "Edge clearance resolution for:" ) + "</h7>" );
|
||||||
|
|
||||||
|
r->Report( wxString::Format( "<ul><li>%s</li><li>%s</li></ul>",
|
||||||
|
EscapeHTML( getItemDescription( a ) ),
|
||||||
|
EscapeHTML( getItemDescription( b ) ) ) );
|
||||||
|
|
||||||
|
reportClearance( EDGE_CLEARANCE_CONSTRAINT, layer, a, b, r );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DRCE_CLEARANCE:
|
||||||
|
if( a->Type() == PCB_TRACE_T || a->Type() == PCB_ARC_T )
|
||||||
|
{
|
||||||
|
layer = a->GetLayer();
|
||||||
|
}
|
||||||
|
else if( b->Type() == PCB_TRACE_T || b->Type() == PCB_ARC_T )
|
||||||
|
{
|
||||||
|
layer = b->GetLayer();
|
||||||
|
}
|
||||||
|
else if( a->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
|
||||||
|
{
|
||||||
|
PAD* pad = static_cast<PAD*>( a );
|
||||||
|
|
||||||
|
if( pad->IsOnLayer( F_Cu ) )
|
||||||
|
layer = F_Cu;
|
||||||
|
else
|
||||||
|
layer = B_Cu;
|
||||||
|
}
|
||||||
|
else if( b->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
|
||||||
|
{
|
||||||
|
PAD* pad = static_cast<PAD*>( b );
|
||||||
|
|
||||||
|
if( pad->IsOnLayer( F_Cu ) )
|
||||||
|
layer = F_Cu;
|
||||||
|
else
|
||||||
|
layer = B_Cu;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->Report( "<h7>" + _( "Clearance resolution for:" ) + "</h7>" );
|
||||||
|
|
||||||
|
r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
|
||||||
|
_( "Layer" ),
|
||||||
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
||||||
|
EscapeHTML( getItemDescription( a ) ),
|
||||||
|
EscapeHTML( getItemDescription( b ) ) ) );
|
||||||
|
|
||||||
|
reportClearance( CLEARANCE_CONSTRAINT, layer, a, b, r );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->Flush();
|
||||||
|
|
||||||
|
m_inspectClearanceDialog->Raise();
|
||||||
|
m_inspectClearanceDialog->Show( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <dialogs/dialog_HTML_reporter_base.h>
|
#include <dialogs/dialog_HTML_reporter_base.h>
|
||||||
#include <dialogs/dialog_constraints_reporter.h>
|
#include <dialogs/dialog_constraints_reporter.h>
|
||||||
#include <pcb_edit_frame.h>
|
#include <pcb_edit_frame.h>
|
||||||
|
#include <rc_item.h>
|
||||||
#include <tools/pcb_actions.h>
|
#include <tools/pcb_actions.h>
|
||||||
#include <tools/pcb_tool_base.h>
|
#include <tools/pcb_tool_base.h>
|
||||||
|
|
||||||
|
@ -111,6 +112,8 @@ public:
|
||||||
///< Show the ratsnest for a given net.
|
///< Show the ratsnest for a given net.
|
||||||
int ShowNet( const TOOL_EVENT& aEvent );
|
int ShowNet( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
void InspectDRCError( const std::shared_ptr<RC_ITEM>& aDRCItem );
|
||||||
|
|
||||||
///< Show the clearance resolution for two selected items.
|
///< Show the clearance resolution for two selected items.
|
||||||
int InspectClearance( const TOOL_EVENT& aEvent );
|
int InspectClearance( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue