7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 05:56:55 +00:00

Make netclass name methods clearer, and improve doc strings

There are two netclass name methods, which previously were not
obvious in their uses. These have been renamed to now have:

GetName() : Used for internal or tooling (e.g. netlist export) usage
GetHumanReadableName() : Used for display to users (e.g. in infobars)

Fixing the previous unclear naming will result in fewer bugs
when users start using the multiple netclass functionality, as
the incorrect usage had started creeping in to new code. Also this
will help authors of new code select the correct name method.
This commit is contained in:
JamesJCode 2025-01-14 20:00:43 +00:00
parent f161d94521
commit c80a71f64a
23 changed files with 215 additions and 213 deletions

View File

@ -738,13 +738,11 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
RAY mouseRay = getRayAtCurrentMousePosition();
BOARD_ITEM* rollOverItem = m_3d_render_raytracing->IntersectBoardItem( mouseRay );
auto printNetInfo =
[]( BOARD_CONNECTED_ITEM* aItem )
{
return wxString::Format( _( "Net %s\tNet class %s" ),
aItem->GetNet()->GetNetname(),
aItem->GetNet()->GetNetClass()->GetName() );
};
auto printNetInfo = []( BOARD_CONNECTED_ITEM* aItem )
{
return wxString::Format( _( "Net %s\tNet class %s" ), aItem->GetNet()->GetNetname(),
aItem->GetNet()->GetNetClass()->GetHumanReadableName() );
};
if( rollOverItem )
{

View File

@ -283,7 +283,7 @@ bool NETCLASS::ContainsNetclassWithName( const wxString& netclass ) const
}
const wxString NETCLASS::GetName() const
const wxString NETCLASS::GetHumanReadableName() const
{
if( m_constituents.size() == 1 )
return m_Name;
@ -311,19 +311,19 @@ const wxString NETCLASS::GetName() const
}
const wxString NETCLASS::GetVariableSubstitutionName() const
const wxString NETCLASS::GetName() const
{
if( m_constituents.size() == 1 )
return m_Name;
wxASSERT( m_constituents.size() >= 2 );
wxString name = m_constituents[0]->GetName();
wxString name = m_constituents[0]->m_Name;
for( std::size_t i = 1; i < m_constituents.size(); ++i )
{
name += ",";
name += m_constituents[i]->GetName();
name += m_constituents[i]->m_Name;
}
return name;

View File

@ -600,8 +600,7 @@ void NET_SETTINGS::ClearCacheForNet( const wxString& netName )
{
if( m_effectiveNetclassCache.count( netName ) )
{
wxString compositeNetclassName =
m_effectiveNetclassCache[netName]->GetVariableSubstitutionName();
wxString compositeNetclassName = m_effectiveNetclassCache[netName]->GetName();
m_compositeNetClasses.erase( compositeNetclassName );
m_effectiveNetclassCache.erase( netName );
}
@ -764,7 +763,7 @@ std::shared_ptr<NETCLASS> NET_SETTINGS::GetEffectiveNetClass( const wxString& aN
{
effectiveNetclass->SetConstituentNetclasses( std::move( netclassPtrs ) );
m_compositeNetClasses[effectiveNetclass->GetVariableSubstitutionName()] = effectiveNetclass;
m_compositeNetClasses[effectiveNetclass->GetName()] = effectiveNetclass;
m_effectiveNetclassCache[aNetName] = effectiveNetclass;
return effectiveNetclass;

View File

@ -539,7 +539,8 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
conn->AppendInfoToMsgPanel( aList );
if( !conn->IsBus() )
aList.emplace_back( _( "Resolved Netclass" ), GetEffectiveNetClass()->GetName() );
aList.emplace_back( _( "Resolved Netclass" ),
GetEffectiveNetClass()->GetHumanReadableName() );
}
}

View File

@ -317,7 +317,7 @@ void SCH_JUNCTION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
if( !conn->IsBus() )
{
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
}
}
}

View File

@ -754,7 +754,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
*token = wxEmptyString;
if( connection )
*token = GetEffectiveNetClass()->GetVariableSubstitutionName();
*token = GetEffectiveNetClass()->GetName();
return true;
}
@ -1218,7 +1218,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
if( !conn->IsBus() )
{
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
}
}
}
@ -1324,9 +1324,9 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Net" ),
connection->Name() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Resolved netclass" ),
GetEffectiveNetClass()->GetName() ) );
properties.emplace_back(
wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
GetEffectiveNetClass()->GetHumanReadableName() ) );
}
for( const SCH_FIELD& field : GetFields() )

View File

@ -895,9 +895,9 @@ void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& a
_( "Net" ),
connection->Name() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Resolved netclass" ),
GetEffectiveNetClass()->GetName() ) );
properties.emplace_back(
wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
GetEffectiveNetClass()->GetHumanReadableName() ) );
}
}
else if( GetLayer() == LAYER_BUS )
@ -955,7 +955,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( !conn->IsBus() )
{
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
}
}
}

View File

@ -80,10 +80,6 @@ public:
/// @brief Sets the netclasses which make up this netclass
void SetConstituentNetclasses( std::vector<NETCLASS*>&& constituents );
/// @brief Gets the name of this (maybe aggregate) netclass in a format for label variable
/// substitutions
const wxString GetVariableSubstitutionName() const;
/// @brief Determines if the given netclass name is a constituent of this (maybe aggregate)
/// netclass
bool ContainsNetclassWithName( const wxString& netclass ) const;
@ -91,9 +87,9 @@ public:
/// @ brief Determines if this is marked as the default netclass
bool IsDefault() const { return m_isDefault; }
/// @brief Gets the consolidated name of this netclass (which may be an aggregate)
const wxString GetName() const;
void SetName( const wxString& aName )
/// @brief Set the name of this netclass. Only relevant for root netclasses (i.e. those which
/// are not an aggregate)
void SetName( const wxString& aName )
{
m_Name = aName;
@ -101,6 +97,16 @@ public:
m_isDefault = true;
}
/// @brief Gets the name of this (maybe aggregate) netclass in a format for internal usage or
/// for export to external tools / netlists. WARNING: Do not use this to display a netclass
/// name to a user. Use GetHumanReadableName instead.
const wxString GetName() const;
/// @brief Gets the consolidated name of this netclass (which may be an aggregate). This is
/// intended for display to users (e.g. in infobars or messages). WARNING: Do not use this
/// to compare equivalence, or to export to other tools)
const wxString GetHumanReadableName() const;
const wxString& GetDescription() const { return m_Description; }
void SetDescription( const wxString& aDesc ) { m_Description = aDesc; }

View File

@ -113,7 +113,7 @@ wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
wxString BOARD_CONNECTED_ITEM::GetNetClassVariableSubstitutionName() const
{
return GetEffectiveNetClass()->GetVariableSubstitutionName();
return GetEffectiveNetClass()->GetName();
}

View File

@ -264,8 +264,7 @@ bool DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataToWindow()
if( g_filterByNetclass && m_netclassFilter->SetStringSelection( g_netclassFilter ) )
m_netclassFilterOpt->SetValue( true );
else if( item )
m_netclassFilter->SetStringSelection(
item->GetNet()->GetNetClass()->GetVariableSubstitutionName() );
m_netclassFilter->SetStringSelection( item->GetNet()->GetNetClass()->GetName() );
if( g_filterByNet && m_brd->FindNet( g_netFilter ) != nullptr )
{

View File

@ -198,8 +198,7 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
}
else if( item )
{
m_netclassFilter->SetStringSelection(
item->GetNet()->GetNetClass()->GetVariableSubstitutionName() );
m_netclassFilter->SetStringSelection( item->GetNet()->GetNetClass()->GetName() );
}
if( g_filterByNet && m_brd->FindNet( g_netFilter ) != nullptr )

View File

@ -241,173 +241,170 @@ void DRC_ENGINE::loadImplicitRules()
std::vector<std::shared_ptr<DRC_RULE>> netclassClearanceRules;
std::vector<std::shared_ptr<DRC_RULE>> netclassItemSpecificRules;
auto makeNetclassRules =
[&]( const std::shared_ptr<NETCLASS>& nc, bool isDefault )
auto makeNetclassRules = [&]( const std::shared_ptr<NETCLASS>& nc, bool isDefault )
{
wxString ncName = nc->GetName();
wxString expr;
ncName.Replace( "'", "\\'" );
if( nc->HasClearance() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format(
_( "netclass '%s'" ), nc->GetClearanceParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassClearanceRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( CLEARANCE_CONSTRAINT );
constraint.Value().SetMin( nc->GetClearance() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasTrackWidth() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format(
_( "netclass '%s'" ), nc->GetTrackWidthParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassClearanceRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( TRACK_WIDTH_CONSTRAINT );
constraint.Value().SetMin( bds.m_TrackMinWidth );
constraint.Value().SetOpt( nc->GetTrackWidth() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasDiffPairWidth() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name =
wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairWidthParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.inDiffPair('*')" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( TRACK_WIDTH_CONSTRAINT );
constraint.Value().SetMin( bds.m_TrackMinWidth );
constraint.Value().SetOpt( nc->GetDiffPairWidth() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasDiffPairGap() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name =
wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairGapParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( DIFF_PAIR_GAP_CONSTRAINT );
constraint.Value().SetMin( bds.m_MinClearance );
constraint.Value().SetOpt( nc->GetDiffPairGap() );
netclassRule->AddConstraint( constraint );
// A narrower diffpair gap overrides the netclass min clearance
if( nc->GetDiffPairGap() < nc->GetClearance() )
{
wxString ncName = nc->GetVariableSubstitutionName();
wxString friendlyName = nc->GetName();
wxString expr;
netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name =
wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairGapParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
ncName.Replace( "'", "\\'" );
expr = wxString::Format( wxT( "A.NetClass == '%s' && AB.isCoupledDiffPair()" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasClearance())
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s'" ),
nc->GetClearanceParent()->GetName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT min_clearanceConstraint( CLEARANCE_CONSTRAINT );
min_clearanceConstraint.Value().SetMin( nc->GetDiffPairGap() );
netclassRule->AddConstraint( min_clearanceConstraint );
}
}
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassClearanceRules.push_back( netclassRule );
if( nc->HasViaDiameter() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format(
_( "netclass '%s'" ), nc->GetViaDiameterParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( CLEARANCE_CONSTRAINT );
constraint.Value().SetMin( nc->GetClearance() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type != 'Micro'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasTrackWidth() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s'" ),
nc->GetTrackWidthParent()->GetName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( VIA_DIAMETER_CONSTRAINT );
constraint.Value().SetMin( bds.m_ViasMinSize );
constraint.Value().SetOpt( nc->GetViaDiameter() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassClearanceRules.push_back( netclassRule );
if( nc->HasViaDrill() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format(
_( "netclass '%s'" ), nc->GetViaDrillParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( TRACK_WIDTH_CONSTRAINT );
constraint.Value().SetMin( bds.m_TrackMinWidth );
constraint.Value().SetOpt( nc->GetTrackWidth() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type != 'Micro'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasDiffPairWidth() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairWidthParent()->GetName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( HOLE_SIZE_CONSTRAINT );
constraint.Value().SetMin( bds.m_MinThroughDrill );
constraint.Value().SetOpt( nc->GetViaDrill() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.inDiffPair('*')" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasuViaDiameter() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name =
wxString::Format( _( "netclass '%s' (uvia)" ),
nc->GetuViaDiameterParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( TRACK_WIDTH_CONSTRAINT );
constraint.Value().SetMin( bds.m_TrackMinWidth );
constraint.Value().SetOpt( nc->GetDiffPairWidth() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type == 'Micro'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasDiffPairGap() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairGapParent()->GetName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( VIA_DIAMETER_CONSTRAINT );
constraint.Value().SetMin( bds.m_MicroViasMinSize );
constraint.Value().SetMin( nc->GetuViaDiameter() );
netclassRule->AddConstraint( constraint );
}
expr = wxString::Format( wxT( "A.NetClass == '%s'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
if( nc->HasuViaDrill() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format(
_( "netclass '%s' (uvia)" ), nc->GetuViaDrillParent()->GetHumanReadableName() );
netclassRule->m_Implicit = true;
DRC_CONSTRAINT constraint( DIFF_PAIR_GAP_CONSTRAINT );
constraint.Value().SetMin( bds.m_MinClearance );
constraint.Value().SetOpt( nc->GetDiffPairGap() );
netclassRule->AddConstraint( constraint );
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type == 'Micro'" ), ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
// A narrower diffpair gap overrides the netclass min clearance
if( nc->GetDiffPairGap() < nc->GetClearance() )
{
netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
nc->GetDiffPairGapParent()->GetName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && AB.isCoupledDiffPair()" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT min_clearanceConstraint( CLEARANCE_CONSTRAINT );
min_clearanceConstraint.Value().SetMin( nc->GetDiffPairGap() );
netclassRule->AddConstraint( min_clearanceConstraint );
}
}
if( nc->HasViaDiameter() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s'" ),
nc->GetViaDiameterParent()->GetName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type != 'Micro'" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( VIA_DIAMETER_CONSTRAINT );
constraint.Value().SetMin( bds.m_ViasMinSize );
constraint.Value().SetOpt( nc->GetViaDiameter() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasViaDrill() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s'" ),
nc->GetViaDrillParent()->GetName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type != 'Micro'" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( HOLE_SIZE_CONSTRAINT );
constraint.Value().SetMin( bds.m_MinThroughDrill );
constraint.Value().SetOpt( nc->GetViaDrill() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasuViaDiameter() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (uvia)" ),
nc->GetuViaDiameterParent()->GetName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type == 'Micro'" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( VIA_DIAMETER_CONSTRAINT );
constraint.Value().SetMin( bds.m_MicroViasMinSize );
constraint.Value().SetMin( nc->GetuViaDiameter() );
netclassRule->AddConstraint( constraint );
}
if( nc->HasuViaDrill() )
{
std::shared_ptr<DRC_RULE> netclassRule = std::make_shared<DRC_RULE>();
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (uvia)" ),
nc->GetuViaDrillParent()->GetName() );
netclassRule->m_Implicit = true;
expr = wxString::Format( wxT( "A.NetClass == '%s' && A.Via_Type == 'Micro'" ),
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( HOLE_SIZE_CONSTRAINT );
constraint.Value().SetMin( bds.m_MicroViasMinDrill );
constraint.Value().SetOpt( nc->GetuViaDrill() );
netclassRule->AddConstraint( constraint );
}
};
DRC_CONSTRAINT constraint( HOLE_SIZE_CONSTRAINT );
constraint.Value().SetMin( bds.m_MicroViasMinDrill );
constraint.Value().SetOpt( nc->GetuViaDrill() );
netclassRule->AddConstraint( constraint );
}
};
m_board->SynchronizeNetsAndNetClasses( false );
makeNetclassRules( bds.m_NetSettings->GetDefaultNetclass(), true );

View File

@ -2131,7 +2131,8 @@ void PCB_TUNING_PATTERN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
}
if( netclass )
aList.emplace_back( _( "Resolved Netclass" ), UnescapeString( netclass->GetName() ) );
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( netclass->GetHumanReadableName() ) );
aList.emplace_back( _( "Layer" ), layerMaskDescribe() );

View File

@ -1293,7 +1293,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
if( IsLocked() )
aList.emplace_back( _( "Status" ), _( "Locked" ) );

View File

@ -1665,7 +1665,7 @@ void PCB_TRACK::GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame,
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
#if 0 // Enable for debugging
if( GetBoard() )

View File

@ -155,7 +155,7 @@ public:
const wxString& AsString() const override
{
const_cast<PCBEXPR_NETCLASS_VALUE*>( this )->Set(
m_item->GetEffectiveNetClass()->GetVariableSubstitutionName() );
m_item->GetEffectiveNetClass()->GetName() );
return LIBEVAL::VALUE::AsString();
}

View File

@ -2685,9 +2685,10 @@ void ROUTER_TOOL::UpdateMessagePanel()
NETCLASS* netclassB = netB->GetNetClass();
if( *netclassA == *netclassB )
netclass = netclassA->GetName();
netclass = netclassA->GetHumanReadableName();
else
netclass = netclassA->GetName() + wxT( ", " ) + netclassB->GetName();
netclass = netclassA->GetHumanReadableName() + wxT( ", " )
+ netclassB->GetHumanReadableName();
secondary = wxString::Format( _( "Resolved Netclass: %s" ),
UnescapeString( netclass ) );
@ -2699,8 +2700,9 @@ void ROUTER_TOOL::UpdateMessagePanel()
description = wxString::Format( _( "Routing Track: %s" ),
net->GetNetname() );
secondary = wxString::Format( _( "Resolved Netclass: %s" ),
UnescapeString( net->GetNetClass()->GetName() ) );
secondary = wxString::Format(
_( "Resolved Netclass: %s" ),
UnescapeString( net->GetNetClass()->GetHumanReadableName() ) );
}
else
{

View File

@ -1737,7 +1737,7 @@ void SPECCTRA_DB::exportNETCLASS( const std::shared_ptr<NETCLASS>& aNetClass, BO
for( NETINFO_ITEM* net : aBoard->GetNetInfo() )
{
if( net->GetNetClass()->GetVariableSubstitutionName() == clazz->m_class_id )
if( net->GetNetClass()->GetName() == clazz->m_class_id )
clazz->m_net_ids.push_back( TO_UTF8( net->GetNetname() ) );
}

View File

@ -197,8 +197,9 @@ wxString BOARD_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem )
{
BOARD_CONNECTED_ITEM* cItem = static_cast<BOARD_CONNECTED_ITEM*>( aItem );
msg += wxS( " " ) + wxString::Format( _( "[netclass %s]" ),
cItem->GetEffectiveNetClass()->GetName() );
msg += wxS( " " )
+ wxString::Format( _( "[netclass %s]" ),
cItem->GetEffectiveNetClass()->GetHumanReadableName() );
}
return msg;

View File

@ -1855,8 +1855,8 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
{
netNames.insert( UnescapeString( bci->GetNetname() ) );
netClasses.insert(
UnescapeString( bci->GetEffectiveNetClass()->GetName() ) );
netClasses.insert( UnescapeString(
bci->GetEffectiveNetClass()->GetHumanReadableName() ) );
if( netNames.size() > 1 && netClasses.size() > 1 )
break;

View File

@ -53,7 +53,7 @@ public:
{
wxASSERT( aNet );
m_net_name = UnescapeString( aNet->GetNetname() );
m_net_class = UnescapeString( aNet->GetNetClass()->GetName() );
m_net_class = UnescapeString( aNet->GetNetClass()->GetHumanReadableName() );
m_column_changed.resize( COLUMN_LAST_STATIC_COL + 1 + 2, 0 );
}

View File

@ -805,7 +805,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ) );
aList.emplace_back( _( "Resolved Netclass" ),
UnescapeString( GetEffectiveNetClass()->GetName() ) );
UnescapeString( GetEffectiveNetClass()->GetHumanReadableName() ) );
}
// Display priority level

View File

@ -59,29 +59,28 @@ BOOST_AUTO_TEST_CASE( TestMultiNetclasses )
std::shared_ptr<NET_SETTINGS>& netSettings = m_schematic.Prj().GetProjectFile().m_NetSettings;
std::shared_ptr<NETCLASS> nc = netSettings->GetEffectiveNetClass( "/BUS.SIGNAL" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS2,CLASS1,Default" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS2,CLASS1,Default" );
nc = netSettings->GetEffectiveNetClass( "/BUS.A0" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS1,CLASS3,Default" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS1,CLASS3,Default" );
nc = netSettings->GetEffectiveNetClass( "/BUS.A1" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS1,Default" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS1,Default" );
nc = netSettings->GetEffectiveNetClass( "/BUS.A2" );
wxString name = nc->GetName();
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS1,CLASS4,Default" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS1,CLASS4,Default" );
nc = netSettings->GetEffectiveNetClass( "/NET_1" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS2,CLASS3,Default" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS2,CLASS3,Default" );
nc = netSettings->GetEffectiveNetClass( "/NET_2" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS_COMPLETE" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS_COMPLETE" );
nc = netSettings->GetEffectiveNetClass( "/NET_3" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS_COMPLETE,CLASS3,CLASS4" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS_COMPLETE,CLASS3,CLASS4" );
nc = netSettings->GetEffectiveNetClass( "/NET_4" );
BOOST_CHECK_EQUAL( nc->GetVariableSubstitutionName(), "CLASS_COMPLETE,CLASS3,CLASS4" );
BOOST_CHECK_EQUAL( nc->GetName(), "CLASS_COMPLETE,CLASS3,CLASS4" );
}
BOOST_AUTO_TEST_SUITE_END()