Nets don't have properites; netclasses do.

This commit is contained in:
Jeff Young 2020-12-08 12:30:07 +00:00
parent 20ad2bee2f
commit 60ecd4698c
4 changed files with 19 additions and 123 deletions

View File

@ -24,7 +24,6 @@
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <board_design_settings.h>
#include <track.h>
#include <tools/pcb_actions.h>
#include <tool/tool_manager.h>
@ -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<const VIA *>( 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<VIA *>( aTrackItem );
if( new_drill > 0 )
via->SetDrill( new_drill );
else

View File

@ -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

View File

@ -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;

View File

@ -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
{