← Back to team overview

kicad-developers team mailing list archive

Additional Patch for via properties dialog

 

Hi,

I added a check to the dialog that notifies the user if the via type was
changed into a type that has bigger minimal sizes.

The user can select to update from the minimal sizes from the netclass of
the via.

Cheers
From 281ff1b94df4c10fc1d43542dc2bc0c78664da9d Mon Sep 17 00:00:00 2001
From: Bastian Neumann <bneumann@xxxxxxxxxxxxxxxxxxxxxxxxxx>
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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp
index 2dc12ca..250d07b 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 )
     {
@@ -373,7 +374,16 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit )
                     v->SetPosition( pos );
                 }
 
-                if( m_viaNetclass->IsChecked() )
+                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() || setNetclassSizes )
                 {
                     switch( v->GetViaType() )
                     {
-- 
2.7.4