From ef7b3c1715ac414cb82efc41926eb545cd95bcf6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 5 Mar 2023 22:34:32 -0500 Subject: [PATCH] Use constraints to determine netclas width Fixes https://gitlab.com/kicad/code/kicad/-/issues/14190 (cherry picked from commit 61d30ee5bcf36175560e749f0361cac45436929b) --- pcbnew/dialogs/dialog_track_via_properties.cpp | 11 ++++++++++- pcbnew/pcb_track.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 73b87184d5..cc27a212f7 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -551,9 +551,18 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) ); if( m_trackNetclass->IsChecked() ) - t->SetWidth( t->GetEffectiveNetClass()->GetTrackWidth() ); + { + MINOPTMAX constraint = t->GetWidthConstraint(); + + if( constraint.HasOpt() ) + t->SetWidth( constraint.Opt() ); + else + t->SetWidth( constraint.Min() ); + } else if( !m_trackWidth.IsIndeterminate() ) + { t->SetWidth( m_trackWidth.GetValue() ); + } int layer = m_TrackLayerCtrl->GetLayerSelection(); diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index f997b489ae..a0904e3830 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -197,7 +197,7 @@ public: */ int GetLocalClearance( wxString* aSource ) const override; - MINOPTMAX GetWidthConstraint( wxString* aSource ) const; + MINOPTMAX GetWidthConstraint( wxString* aSource = nullptr ) const; wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;