ADDED allow update of teardrops before running DRC.

Fixes https://gitlab.com/kicad/code/kicad/issues/14264
This commit is contained in:
Jeff Young 2023-04-15 12:08:33 +01:00
parent 521aa5b5ae
commit 2d15067453
12 changed files with 122 additions and 35 deletions

View File

@ -235,7 +235,7 @@ public:
BOARD_STACKUP& GetStackupDescriptor() { return m_stackup; }
const BOARD_STACKUP& GetStackupDescriptor() const { return m_stackup; }
TEARDROP_PARAMETERS_LIST* GetTeadropParamsList()
TEARDROP_PARAMETERS_LIST* GetTeardropParamsList()
{
return &m_TeardropParamsList;
}

View File

@ -467,13 +467,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
nlohmann::json js = nlohmann::json::array();
nlohmann::json entry = {};
entry["td_onviapad"] = m_TeardropParamsList.m_TargetViasPads;
entry["td_onpadsmd"] = m_TeardropParamsList.m_TargetPadsWithNoHole;
entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track;
entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly;
entry["td_onviapad"] = m_TeardropParamsList.m_TargetViasPads;
entry["td_onpadsmd"] = m_TeardropParamsList.m_TargetPadsWithNoHole;
entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track;
entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly;
entry["td_allow_use_two_tracks"] = m_TeardropParamsList.m_AllowUseTwoTracks;
entry["td_curve_segcount"] = m_TeardropParamsList.m_CurveSegCount;
entry["td_on_pad_in_zone"] = m_TeardropParamsList.m_TdOnPadsInZones;
entry["td_curve_segcount"] = m_TeardropParamsList.m_CurveSegCount;
entry["td_on_pad_in_zone"] = m_TeardropParamsList.m_TdOnPadsInZones;
js.push_back( entry );

View File

@ -131,6 +131,7 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_ignoredTitleTemplate = m_Notebook->GetPageText( 3 );
m_cbRefillZones->SetValue( cfg->m_DrcDialog.refill_zones );
m_cbUpdateTeardrops->SetValue( cfg->m_DrcDialog.update_teardrops );
m_cbReportAllTrackErrors->SetValue( cfg->m_DrcDialog.test_all_track_errors );
if( !Kiface().IsSingle() )
@ -161,6 +162,7 @@ DIALOG_DRC::~DIALOG_DRC()
PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings();
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
settings->m_DrcDialog.update_teardrops = m_cbUpdateTeardrops->GetValue();
settings->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();
if( !Kiface().IsSingle() )
@ -237,6 +239,7 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
DRC_TOOL* drcTool = toolMgr->GetTool<DRC_TOOL>();
ZONE_FILLER_TOOL* zoneFillerTool = toolMgr->GetTool<ZONE_FILLER_TOOL>();
bool refillZones = m_cbRefillZones->GetValue();
bool updateTeardrops = m_cbUpdateTeardrops->GetValue();
bool reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue();
bool testFootprints = m_cbTestFootprints->GetValue();
@ -302,7 +305,7 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
{
wxBusyCursor dummy;
drcTool->RunTests( this, refillZones, reportAllTrackErrors, testFootprints );
drcTool->RunTests( this, refillZones, updateTeardrops, reportAllTrackErrors, testFootprints );
}
if( m_cancelled )

View File

@ -27,10 +27,8 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_cbRefillZones = new wxCheckBox( this, wxID_ANY, _("Refill all zones before performing DRC"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_cbRefillZones, 0, wxALL, 5 );
m_cbReportAllTrackErrors = new wxCheckBox( this, wxID_ANY, _("Report all errors for each track"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbReportAllTrackErrors->SetToolTip( _("If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs.\n\nIf unselected, only the first DRC violation will be reported for each track connection.") );
bSizer12->Add( m_cbReportAllTrackErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbUpdateTeardrops = new wxCheckBox( this, wxID_ANY, _("Update teardrops before performing DRC"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_cbUpdateTeardrops, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerOptions->Add( bSizer12, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
@ -38,6 +36,11 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
wxBoxSizer* bSizerOptSettings;
bSizerOptSettings = new wxBoxSizer( wxVERTICAL );
m_cbReportAllTrackErrors = new wxCheckBox( this, wxID_ANY, _("Report all errors for each track"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbReportAllTrackErrors->SetToolTip( _("If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs.\n\nIf unselected, only the first DRC violation will be reported for each track connection.") );
bSizerOptSettings->Add( m_cbReportAllTrackErrors, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_cbTestFootprints = new wxCheckBox( this, wxID_ANY, _("Test for parity between PCB and schematic"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerOptSettings->Add( m_cbTestFootprints, 0, wxALL, 5 );
@ -45,7 +48,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSizerOptions->Add( bSizerOptSettings, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 3 );
m_MainSizer->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_runningResultsBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
running = new wxPanel( m_runningResultsBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -148,7 +151,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSizer15->Fit( m_panelIgnored );
m_Notebook->AddPage( m_panelIgnored, _("Ignored Tests (%s)"), false );
bSizer13->Add( m_Notebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bSizer13->Add( m_Notebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
results->SetSizer( bSizer13 );
@ -199,7 +202,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSizer9->Add( bSeveritySizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizer9->Add( bSeveritySizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -64,7 +64,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
@ -145,10 +145,85 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Update teardrops before performing DRC</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbUpdateTeardrops</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerOptSettings</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -209,17 +284,6 @@
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerOptSettings</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@ -721,7 +785,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
@ -1274,7 +1338,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>

View File

@ -50,6 +50,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM
protected:
wxCheckBox* m_cbRefillZones;
wxCheckBox* m_cbUpdateTeardrops;
wxCheckBox* m_cbReportAllTrackErrors;
wxCheckBox* m_cbTestFootprints;
wxSimplebook* m_runningResultsBook;

View File

@ -274,6 +274,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "drc_dialog.refill_zones",
&m_DrcDialog.refill_zones, true ) );
m_params.emplace_back( new PARAM<bool>( "drc_dialog.update_teardrops",
&m_DrcDialog.update_teardrops, true ) );
m_params.emplace_back( new PARAM<bool>( "drc_dialog.test_all_track_errors",
&m_DrcDialog.test_all_track_errors, false ) );

View File

@ -158,6 +158,7 @@ public:
struct DIALOG_DRC
{
bool refill_zones;
bool update_teardrops;
bool test_all_track_errors;
bool test_footprints;
int severities;

View File

@ -59,7 +59,7 @@ public:
m_bitmapTdTrackInfo->SetBitmap( KiBitmap( BITMAPS::teardrop_track_sizes ) );
m_brdSettings = &m_frame->GetBoard()->GetBoard()->GetDesignSettings();
TEARDROP_PARAMETERS_LIST* prmsList = m_brdSettings->GetTeadropParamsList();
TEARDROP_PARAMETERS_LIST* prmsList = m_brdSettings->GetTeardropParamsList();
m_cbPadVia->SetValue( prmsList->m_TargetViasPads );
m_cbSmdSimilarPads->SetValue( prmsList->m_TargetPadsWithNoHole );
@ -109,7 +109,7 @@ public:
void TransferToParamList()
{
int shape_seg_count = GetCurvePointCount();
TEARDROP_PARAMETERS_LIST* prmsList = m_brdSettings->GetTeadropParamsList();
TEARDROP_PARAMETERS_LIST* prmsList = m_brdSettings->GetTeardropParamsList();
prmsList->m_TargetViasPads = m_cbPadVia->GetValue();
prmsList->m_TargetPadsWithNoHole = m_cbSmdSimilarPads->GetValue();

View File

@ -46,7 +46,7 @@
TEARDROP_MANAGER::TEARDROP_MANAGER( BOARD* aBoard, PCB_EDIT_FRAME* aFrame )
{
m_board = aBoard;
m_prmsList = m_board->GetDesignSettings().GetTeadropParamsList();
m_prmsList = m_board->GetDesignSettings().GetTeardropParamsList();
m_tolerance = 0;
}

View File

@ -36,6 +36,7 @@
#include <drc/drc_engine.h>
#include <drc/drc_item.h>
#include <netlist_reader/pcb_netlist.h>
#include <teardrop/teardrop.h>
DRC_TOOL::DRC_TOOL() :
PCB_TOOL_BASE( "pcbnew.DRCTool" ),
@ -129,7 +130,7 @@ void DRC_TOOL::DestroyDRCDialog()
void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones,
bool aReportAllTrackErrors, bool aTestFootprints )
bool aUpdateTeardrops, bool aReportAllTrackErrors, bool aTestFootprints )
{
// One at a time, please.
// Note that the main GUI entry points to get here are blocked, so this is really an
@ -152,6 +153,17 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones
zoneFiller->FillAllZones( m_drcDialog, aProgressReporter );
}
if( aUpdateTeardrops )
{
aProgressReporter->AdvancePhase( _( "Updating teardrops..." ) );
BOARD* board( m_editFrame->GetBoard() );
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
TEARDROP_MANAGER teardropManager( board, m_editFrame );
teardropManager.SetTeardrops( &commit, bds.GetTeardropParamsList()->m_AllowUseTwoTracks );
}
m_drcEngine->SetDrawingSheet( m_editFrame->GetCanvas()->GetDrawingSheet() );
if( aTestFootprints && !Kiface().IsSingle() )

View File

@ -80,7 +80,7 @@ public:
/**
* Run the DRC tests.
*/
void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones,
void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones, bool aUpdateTeardrops,
bool aReportAllTrackErrors, bool aTestFootprints );
int PrevMarker( const TOOL_EVENT& aEvent );