Separate Cleanup Via from Cleanup Track
There are cases where you will want to keep vias that only connect to one layer but still want to cleanup tracks. As distinct entities, they are given their own checkboxes and actions Fixes https://gitlab.com/kicad/code/kicad/issues/5019
This commit is contained in:
parent
71882a7b0e
commit
51d7fea934
|
@ -30,6 +30,7 @@
|
||||||
CLEANUP_ITEM::CLEANUP_ITEM( int aErrorCode )
|
CLEANUP_ITEM::CLEANUP_ITEM( int aErrorCode )
|
||||||
{
|
{
|
||||||
m_errorCode = aErrorCode;
|
m_errorCode = aErrorCode;
|
||||||
|
m_errorTitle = GetErrorText( aErrorCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
|
||||||
m_deleteUnconnectedOpt->SetValue( cfg->m_Cleanup.cleanup_unconnected );
|
m_deleteUnconnectedOpt->SetValue( cfg->m_Cleanup.cleanup_unconnected );
|
||||||
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
|
m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits );
|
||||||
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
|
m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad );
|
||||||
|
m_deleteDanglingViasOpt->SetValue( cfg->m_Cleanup.delete_dangling_vias );
|
||||||
|
|
||||||
m_changesTreeModel = new RC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
m_changesTreeModel = new RC_TREE_MODEL( m_parentFrame, m_changesDataView );
|
||||||
m_changesDataView->AssociateModel( m_changesTreeModel );
|
m_changesDataView->AssociateModel( m_changesTreeModel );
|
||||||
|
@ -53,8 +54,9 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME*
|
||||||
m_sdbSizerOK->SetLabel( _( "Update PCB" ) );
|
m_sdbSizerOK->SetLabel( _( "Update PCB" ) );
|
||||||
|
|
||||||
m_sdbSizerOK->SetDefault();
|
m_sdbSizerOK->SetDefault();
|
||||||
GetSizer()->SetSizeHints(this);
|
m_sdbSizer->SetSizeHints( this );
|
||||||
Centre();
|
|
||||||
|
FinishDialogSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::~DIALOG_CLEANUP_TRACKS_AND_VIAS()
|
||||||
cfg->m_Cleanup.cleanup_unconnected = m_deleteUnconnectedOpt->GetValue();
|
cfg->m_Cleanup.cleanup_unconnected = m_deleteUnconnectedOpt->GetValue();
|
||||||
cfg->m_Cleanup.cleanup_short_circuits = m_cleanShortCircuitOpt->GetValue();
|
cfg->m_Cleanup.cleanup_short_circuits = m_cleanShortCircuitOpt->GetValue();
|
||||||
cfg->m_Cleanup.cleanup_tracks_in_pad = m_deleteTracksInPadsOpt->GetValue();
|
cfg->m_Cleanup.cleanup_tracks_in_pad = m_deleteTracksInPadsOpt->GetValue();
|
||||||
|
cfg->m_Cleanup.delete_dangling_vias = m_deleteDanglingViasOpt->GetValue();
|
||||||
|
|
||||||
for( CLEANUP_ITEM* item : m_items )
|
for( CLEANUP_ITEM* item : m_items )
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -124,7 +127,8 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
|
||||||
m_cleanViasOpt->GetValue(),
|
m_cleanViasOpt->GetValue(),
|
||||||
m_mergeSegmOpt->GetValue(),
|
m_mergeSegmOpt->GetValue(),
|
||||||
m_deleteUnconnectedOpt->GetValue(),
|
m_deleteUnconnectedOpt->GetValue(),
|
||||||
m_deleteTracksInPadsOpt->GetValue() );
|
m_deleteTracksInPadsOpt->GetValue(),
|
||||||
|
m_deleteDanglingViasOpt->GetValue() );
|
||||||
|
|
||||||
if( aDryRun )
|
if( aDryRun )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -29,17 +29,20 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( wxWind
|
||||||
|
|
||||||
bSizerUpper->Add( m_cleanViasOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
bSizerUpper->Add( m_cleanViasOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
m_deleteDanglingViasOpt = new wxCheckBox( this, wxID_ANY, _("Delete vias connected only on one layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerUpper->Add( m_deleteDanglingViasOpt, 0, wxALL, 5 );
|
||||||
|
|
||||||
m_mergeSegmOpt = new wxCheckBox( this, wxID_ANY, _("&Merge co-linear tracks"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_mergeSegmOpt = new wxCheckBox( this, wxID_ANY, _("&Merge co-linear tracks"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_mergeSegmOpt->SetToolTip( _("merge aligned track segments, and remove null segments") );
|
m_mergeSegmOpt->SetToolTip( _("merge aligned track segments, and remove null segments") );
|
||||||
|
|
||||||
bSizerUpper->Add( m_mergeSegmOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
bSizerUpper->Add( m_mergeSegmOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_deleteUnconnectedOpt = new wxCheckBox( this, wxID_ANY, _("Delete &dangling tracks"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_deleteUnconnectedOpt = new wxCheckBox( this, wxID_ANY, _("Delete tracks unconnected at one end"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_deleteUnconnectedOpt->SetToolTip( _("delete tracks having at least one dangling end") );
|
m_deleteUnconnectedOpt->SetToolTip( _("delete tracks having at least one dangling end") );
|
||||||
|
|
||||||
bSizerUpper->Add( m_deleteUnconnectedOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
bSizerUpper->Add( m_deleteUnconnectedOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_deleteTracksInPadsOpt = new wxCheckBox( this, wxID_ANY, _("Delete Tracks in Pads"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_deleteTracksInPadsOpt = new wxCheckBox( this, wxID_ANY, _("Delete tracks fully inside pads"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_deleteTracksInPadsOpt->SetToolTip( _("Delete tracks that have both start and end positions inside of a pad") );
|
m_deleteTracksInPadsOpt->SetToolTip( _("Delete tracks that have both start and end positions inside of a pad") );
|
||||||
|
|
||||||
bSizerUpper->Add( m_deleteTracksInPadsOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
bSizerUpper->Add( m_deleteTracksInPadsOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||||
|
@ -80,6 +83,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( wxWind
|
||||||
// Connect Events
|
// Connect Events
|
||||||
m_cleanShortCircuitOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_cleanShortCircuitOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_cleanViasOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_cleanViasOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
|
m_deleteDanglingViasOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_mergeSegmOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_mergeSegmOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_deleteUnconnectedOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_deleteUnconnectedOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_deleteTracksInPadsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_deleteTracksInPadsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
|
@ -92,6 +96,7 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::~DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE()
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
m_cleanShortCircuitOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_cleanShortCircuitOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_cleanViasOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_cleanViasOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
|
m_deleteDanglingViasOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_mergeSegmOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_mergeSegmOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_deleteUnconnectedOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_deleteUnconnectedOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
m_deleteTracksInPadsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
m_deleteTracksInPadsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::OnCheckBox ), NULL, this );
|
||||||
|
|
|
@ -197,6 +197,71 @@
|
||||||
<event name="OnCheckBox">OnCheckBox</event>
|
<event name="OnCheckBox">OnCheckBox</event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL</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">Delete vias connected only on one layer</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_deleteDanglingViasOpt</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>
|
||||||
|
<event name="OnCheckBox">OnCheckBox</event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
<object class="sizeritem" expanded="0">
|
<object class="sizeritem" expanded="0">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -36,6 +36,7 @@ class DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
|
||||||
protected:
|
protected:
|
||||||
wxCheckBox* m_cleanShortCircuitOpt;
|
wxCheckBox* m_cleanShortCircuitOpt;
|
||||||
wxCheckBox* m_cleanViasOpt;
|
wxCheckBox* m_cleanViasOpt;
|
||||||
|
wxCheckBox* m_deleteDanglingViasOpt;
|
||||||
wxCheckBox* m_mergeSegmOpt;
|
wxCheckBox* m_mergeSegmOpt;
|
||||||
wxCheckBox* m_deleteUnconnectedOpt;
|
wxCheckBox* m_deleteUnconnectedOpt;
|
||||||
wxCheckBox* m_deleteTracksInPadsOpt;
|
wxCheckBox* m_deleteTracksInPadsOpt;
|
||||||
|
|
|
@ -174,6 +174,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
||||||
m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_vias",
|
m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_vias",
|
||||||
&m_Cleanup.cleanup_vias, true ) );
|
&m_Cleanup.cleanup_vias, true ) );
|
||||||
|
|
||||||
|
m_params.emplace_back( new PARAM<bool>( "cleanup.delete_dangling_vias",
|
||||||
|
&m_Cleanup.delete_dangling_vias, true ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<bool>( "cleanup.merge_segments",
|
m_params.emplace_back( new PARAM<bool>( "cleanup.merge_segments",
|
||||||
&m_Cleanup.merge_segments, true ) );
|
&m_Cleanup.merge_segments, true ) );
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
struct DIALOG_CLEANUP
|
struct DIALOG_CLEANUP
|
||||||
{
|
{
|
||||||
bool cleanup_vias;
|
bool cleanup_vias;
|
||||||
|
bool delete_dangling_vias;
|
||||||
bool cleanup_tracks_in_pad;
|
bool cleanup_tracks_in_pad;
|
||||||
bool cleanup_unconnected;
|
bool cleanup_unconnected;
|
||||||
bool cleanup_short_circuits;
|
bool cleanup_short_circuits;
|
||||||
|
|
|
@ -52,8 +52,10 @@ TRACKS_CLEANER::TRACKS_CLEANER( BOARD* aPcb, BOARD_COMMIT& aCommit ) :
|
||||||
*/
|
*/
|
||||||
void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<CLEANUP_ITEM*>* aItemsList,
|
void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<CLEANUP_ITEM*>* aItemsList,
|
||||||
bool aRemoveMisConnected, bool aCleanVias, bool aMergeSegments,
|
bool aRemoveMisConnected, bool aCleanVias, bool aMergeSegments,
|
||||||
bool aDeleteUnconnected, bool aDeleteTracksinPad )
|
bool aDeleteUnconnected, bool aDeleteTracksinPad, bool aDeleteDanglingVias )
|
||||||
{
|
{
|
||||||
|
bool has_deleted = false;
|
||||||
|
|
||||||
m_dryRun = aDryRun;
|
m_dryRun = aDryRun;
|
||||||
m_itemsList = aItemsList;
|
m_itemsList = aItemsList;
|
||||||
|
|
||||||
|
@ -80,15 +82,14 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<CLEANUP_ITEM*>* aIt
|
||||||
|
|
||||||
// Delete dangling tracks
|
// Delete dangling tracks
|
||||||
if( aDeleteUnconnected )
|
if( aDeleteUnconnected )
|
||||||
{
|
has_deleted = deleteDanglingTracks( false );
|
||||||
if( deleteDanglingTracks() )
|
|
||||||
{
|
// Delete dangling vias
|
||||||
// Removed tracks can leave aligned segments
|
if( aDeleteDanglingVias )
|
||||||
// (when a T was formed by tracks and the "vertical" segment is removed)
|
has_deleted |= deleteDanglingTracks( true );
|
||||||
if( aMergeSegments )
|
|
||||||
|
if( has_deleted && aMergeSegments )
|
||||||
cleanupSegments();
|
cleanupSegments();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the flag used to mark some segments:
|
// Clear the flag used to mark some segments:
|
||||||
for( TRACK* segment : m_brd->Tracks() )
|
for( TRACK* segment : m_brd->Tracks() )
|
||||||
|
@ -234,7 +235,7 @@ bool TRACKS_CLEANER::testTrackEndpointIsNode( TRACK* aTrack, bool aTstStart )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TRACKS_CLEANER::deleteDanglingTracks()
|
bool TRACKS_CLEANER::deleteDanglingTracks( bool aVia )
|
||||||
{
|
{
|
||||||
bool item_erased = false;
|
bool item_erased = false;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
@ -253,13 +254,20 @@ bool TRACKS_CLEANER::deleteDanglingTracks()
|
||||||
bool flag_erase = false; // Start without a good reason to erase it
|
bool flag_erase = false; // Start without a good reason to erase it
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
|
if( aVia && track->Type() != PCB_VIA_T )
|
||||||
|
continue;
|
||||||
|
else if( !aVia && track->Type() == PCB_VIA_T )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Tst if a track (or a via) endpoint is not connected to another track or to a zone.
|
// Tst if a track (or a via) endpoint is not connected to another track or to a zone.
|
||||||
if( m_brd->GetConnectivity()->TestTrackEndpointDangling( track, &pos ) )
|
if( m_brd->GetConnectivity()->TestTrackEndpointDangling( track, &pos ) )
|
||||||
flag_erase = true;
|
flag_erase = true;
|
||||||
|
|
||||||
if( flag_erase )
|
if( flag_erase )
|
||||||
{
|
{
|
||||||
int errorCode = track->IsTrack() ? CLEANUP_DANGLING_TRACK : CLEANUP_DANGLING_VIA;
|
int errorCode =
|
||||||
|
( track->Type() != PCB_VIA_T ) ?
|
||||||
|
CLEANUP_DANGLING_TRACK : CLEANUP_DANGLING_VIA;
|
||||||
CLEANUP_ITEM* item = new CLEANUP_ITEM( errorCode );
|
CLEANUP_ITEM* item = new CLEANUP_ITEM( errorCode );
|
||||||
item->SetItems( track );
|
item->SetItems( track );
|
||||||
m_itemsList->push_back( item );
|
m_itemsList->push_back( item );
|
||||||
|
|
|
@ -45,10 +45,11 @@ public:
|
||||||
* @param aMergeSegments = true to merge collinear segmenst and remove 0 len segm
|
* @param aMergeSegments = true to merge collinear segmenst and remove 0 len segm
|
||||||
* @param aDeleteUnconnected = true to remove dangling tracks
|
* @param aDeleteUnconnected = true to remove dangling tracks
|
||||||
* @param aDeleteTracksinPad = true to remove tracks fully inside pads
|
* @param aDeleteTracksinPad = true to remove tracks fully inside pads
|
||||||
|
* @param aDeleteDanglingVias = true to remove a via that is only connected to a single layer
|
||||||
*/
|
*/
|
||||||
void CleanupBoard( bool aDryRun, std::vector<CLEANUP_ITEM*>* aItemsList, bool aCleanVias,
|
void CleanupBoard( bool aDryRun, std::vector<CLEANUP_ITEM*>* aItemsList, bool aCleanVias,
|
||||||
bool aRemoveMisConnected, bool aMergeSegments, bool aDeleteUnconnected,
|
bool aRemoveMisConnected, bool aMergeSegments, bool aDeleteUnconnected,
|
||||||
bool aDeleteTracksinPad );
|
bool aDeleteTracksinPad, bool aDeleteDanglingVias );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*
|
/*
|
||||||
|
@ -61,7 +62,12 @@ private:
|
||||||
*/
|
*/
|
||||||
void cleanupVias();
|
void cleanupVias();
|
||||||
|
|
||||||
bool deleteDanglingTracks();
|
/**
|
||||||
|
* Removes tracks or vias only connected on one end
|
||||||
|
* @param aVia if true, clean vias, if false clean tracks
|
||||||
|
* @return true if any items were deleted
|
||||||
|
*/
|
||||||
|
bool deleteDanglingTracks( bool aVia );
|
||||||
|
|
||||||
void deleteTracksInPads();
|
void deleteTracksInPads();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue