diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index b6d60ca87d..42389ce0e0 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -33,19 +32,15 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, PICKED_ITEMS_LIST* aItemsListPicker, bool aUseNetclassValue ) { - int initial_width; - int new_width; - int initial_drill = -1; - int new_drill = -1; - NETINFO_ITEM* net = NULL; - - if( aUseNetclassValue ) - net = aTrackItem->GetNet(); + int initial_width; + int new_width; + int initial_drill = -1; + int new_drill = -1; initial_width = aTrackItem->GetWidth(); - if( net ) - new_width = net->GetTrackWidth(); + if( aUseNetclassValue ) + new_width = aTrackItem->GetNetClass()->GetTrackWidth(); else new_width = GetDesignSettings().GetCurrentTrackWidth(); @@ -53,19 +48,13 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, { const VIA *via = static_cast( aTrackItem ); - // Micro vias have a size only defined in their netclass - // (no specific values defined by a table of specific value) - // Ensure the netclass is accessible: - if( via->GetViaType() == VIATYPE::MICROVIA && net == NULL ) - net = aTrackItem->GetNet(); - - // Get the draill value, regardless it is default or specific + // Get the drill value, regardless it is default or specific initial_drill = via->GetDrillValue(); - if( net ) + if( aUseNetclassValue || via->GetViaType() == VIATYPE::MICROVIA ) { - new_width = net->GetViaSize(); - new_drill = net->GetViaDrillSize(); + new_width = aTrackItem->GetNetClass()->GetViaDiameter(); + new_drill = aTrackItem->GetNetClass()->GetViaDrill(); } else { @@ -73,19 +62,6 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, new_drill = GetDesignSettings().GetCurrentViaDrill(); } - if( via->GetViaType() == VIATYPE::MICROVIA ) - { - if( net ) - { - new_width = net->GetMicroViaSize(); - new_drill = net->GetMicroViaDrillSize(); - } - else - { - // Should not occur - } - } - // Old versions set a drill value <= 0, when the default netclass it used // but it could be better to set the drill value to the actual value // to avoid issues for existing vias, if the default drill value is modified @@ -112,6 +88,7 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, { // Set new drill value. Note: currently microvias have only a default drill value VIA *via = static_cast( aTrackItem ); + if( new_drill > 0 ) via->SetDrill( new_drill ); else diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index eedef5bd44..d831992c32 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -136,83 +136,6 @@ public: return m_netClass ? m_netClass->GetName() : NETCLASS::Default; } -#if 1 - - /** - * Function GetTrackWidth - * returns the width of tracks used to route this net. - */ - int GetTrackWidth() - { - wxASSERT( m_netClass ); - return m_netClass->GetTrackWidth(); - } - - /** - * Function GetViaSize - * returns the size of vias used to route this net - */ - int GetViaSize() - { - wxASSERT( m_netClass ); - return m_netClass->GetViaDiameter(); - } - - /** - * Function GetMicroViaSize - * returns the size of vias used to route this net - */ - int GetMicroViaSize() - { - wxASSERT( m_netClass ); - return m_netClass->GetuViaDiameter(); - } - - /** - * Function GetViaDrillSize - * returns the size of via drills used to route this net - */ - int GetViaDrillSize() - { - wxASSERT( m_netClass ); - return m_netClass->GetViaDrill(); - } - - /** - * Function GetViaDrillSize - * returns the size of via drills used to route this net - */ - int GetMicroViaDrillSize() - { - wxASSERT( m_netClass ); - return m_netClass->GetuViaDrill(); - } - - -#if 0 - - /** - * Function GetViaMinSize - * returns the Minimum value for via sizes (used in DRC) - */ - int GetViaMinSize() - { - wxASSERT( m_NetClass ); - return m_NetClass->GetViaMinSize(); - } - -#endif - - /** - * Function GetClearance - */ - int GetClearance() - { - return m_netClass ? m_netClass->GetClearance() : 0; - } - -#endif - /** * Function GetNet * @return int - the netcode diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 53a9b25247..2274d0986a 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2328,15 +2328,11 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) // else error: will be removed later via->SetLayerPair( first_layer, last_layer ); - // Update diameter and hole size, which where set previously - // for normal vias - NETINFO_ITEM* net = via->GetNet(); + // Update diameter and hole size, which where set previously for normal vias + NETCLASS* netClass = via->GetNetClass(); - if( net ) - { - via->SetWidth( net->GetMicroViaSize() ); - via->SetDrill( net->GetMicroViaDrillSize() ); - } + via->SetWidth( netClass->GetuViaDiameter() ); + via->SetDrill( netClass->GetuViaDrill() ); } break; diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index a98a2fdd4a..b396b75728 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -675,10 +675,10 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent ) if( via->GetViaType() == VIATYPE::MICROVIA ) { - NETINFO_ITEM* net = via->GetNet(); + NETCLASS* netClass = via->GetNetClass(); - new_width = net->GetMicroViaSize(); - new_drill = net->GetMicroViaDrillSize(); + new_width = netClass->GetuViaDiameter(); + new_drill = netClass->GetuViaDrill(); } else {