Hi, the last patch for this function was not correct I am sorry. This patch gives the correct functionality to notify the user when die via size is smaller than the minimum size given in the net class.
Cheers
From 07756c6c7d28aac83cf9ee7b0e087c8b6b09bd01 Mon Sep 17 00:00:00 2001 From: Bastian Neumann <[email protected]> Date: Fri, 18 Aug 2017 18:59:33 +0200 Subject: [PATCH] Changing via types into a type that has a bigger minimum drill and size value shows a dialog to choose whether to get sizes from netclass or ignore the problem. --- pcbnew/dialogs/dialog_track_via_properties.cpp | 31 ++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 2dc12ca..6263765 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -289,6 +289,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit ) bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED; bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED; + bool setNetclassSizes = false; for( auto item : m_items ) { @@ -372,8 +373,33 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit ) v->SetPosition( pos ); } + + if( m_ViaTypeChoice->GetSelection() != VIA_NOT_DEFINED ) + v->SetViaType( (VIATYPE_T)m_ViaTypeChoice->GetSelection() ); + + if( m_ViaTypeChoice->GetSelection() == VIA_MICROVIA && ( + v->GetWidth() < v->GetNetClass()->GetuViaDiameter() + || v->GetDrill() < v->GetNetClass()->GetuViaDrill() ) ) + { + wxMessageDialog dlg( this, _( "MicroVia sizes are smaller than net class. Use net class instead?" ), wxEmptyString, wxYES_NO ); + if( dlg.ShowModal() == wxID_YES ) + { + m_viaNetclass->SetValue(true); + setNetclassSizes = true; + } + } + else if( v->GetWidth() < v->GetNetClass()->GetViaDiameter() + || v->GetDrill() < v->GetNetClass()->GetViaDrill() ) + { + wxMessageDialog dlg( this, _( "Via sizes are smaller than net class. Use net class instead?" ), wxEmptyString, wxYES_NO ); + if( dlg.ShowModal() == wxID_YES ) + { + m_viaNetclass->SetValue(true); + setNetclassSizes = true; + } + } - if( m_viaNetclass->IsChecked() ) + if( m_viaNetclass->IsChecked() || setNetclassSizes ) { switch( v->GetViaType() ) { @@ -415,9 +441,6 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit ) if( startLayer != UNDEFINED_LAYER && endLayer != UNDEFINED_LAYER) v->SetLayerPair( (PCB_LAYER_ID)startLayer, (PCB_LAYER_ID)endLayer ); - if( m_ViaTypeChoice->GetSelection() != VIA_NOT_DEFINED ) - v->SetViaType( (VIATYPE_T)m_ViaTypeChoice->GetSelection() ); - if( changeLock ) v->SetLocked( setLock ); -- 2.7.4
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

