Use constraints to determine netclas width

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14190


(cherry picked from commit 61d30ee5bc)
This commit is contained in:
Jon Evans 2023-03-05 22:34:32 -05:00
parent 6eb96851f9
commit ef7b3c1715
2 changed files with 11 additions and 2 deletions

View File

@ -551,9 +551,18 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) ); t->SetEnd( wxPoint( t->GetEnd().x, m_trackEndY.GetValue() ) );
if( m_trackNetclass->IsChecked() ) if( m_trackNetclass->IsChecked() )
t->SetWidth( t->GetEffectiveNetClass()->GetTrackWidth() ); {
MINOPTMAX<int> constraint = t->GetWidthConstraint();
if( constraint.HasOpt() )
t->SetWidth( constraint.Opt() );
else
t->SetWidth( constraint.Min() );
}
else if( !m_trackWidth.IsIndeterminate() ) else if( !m_trackWidth.IsIndeterminate() )
{
t->SetWidth( m_trackWidth.GetValue() ); t->SetWidth( m_trackWidth.GetValue() );
}
int layer = m_TrackLayerCtrl->GetLayerSelection(); int layer = m_TrackLayerCtrl->GetLayerSelection();

View File

@ -197,7 +197,7 @@ public:
*/ */
int GetLocalClearance( wxString* aSource ) const override; int GetLocalClearance( wxString* aSource ) const override;
MINOPTMAX<int> GetWidthConstraint( wxString* aSource ) const; MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;