Nets don't have properites; netclasses do.
This commit is contained in:
parent
20ad2bee2f
commit
60ecd4698c
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include <pcb_edit_frame.h>
|
#include <pcb_edit_frame.h>
|
||||||
#include <pcbnew_id.h>
|
#include <pcbnew_id.h>
|
||||||
#include <board_design_settings.h>
|
|
||||||
#include <track.h>
|
#include <track.h>
|
||||||
#include <tools/pcb_actions.h>
|
#include <tools/pcb_actions.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
|
@ -33,19 +32,15 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
PICKED_ITEMS_LIST* aItemsListPicker,
|
PICKED_ITEMS_LIST* aItemsListPicker,
|
||||||
bool aUseNetclassValue )
|
bool aUseNetclassValue )
|
||||||
{
|
{
|
||||||
int initial_width;
|
int initial_width;
|
||||||
int new_width;
|
int new_width;
|
||||||
int initial_drill = -1;
|
int initial_drill = -1;
|
||||||
int new_drill = -1;
|
int new_drill = -1;
|
||||||
NETINFO_ITEM* net = NULL;
|
|
||||||
|
|
||||||
if( aUseNetclassValue )
|
|
||||||
net = aTrackItem->GetNet();
|
|
||||||
|
|
||||||
initial_width = aTrackItem->GetWidth();
|
initial_width = aTrackItem->GetWidth();
|
||||||
|
|
||||||
if( net )
|
if( aUseNetclassValue )
|
||||||
new_width = net->GetTrackWidth();
|
new_width = aTrackItem->GetNetClass()->GetTrackWidth();
|
||||||
else
|
else
|
||||||
new_width = GetDesignSettings().GetCurrentTrackWidth();
|
new_width = GetDesignSettings().GetCurrentTrackWidth();
|
||||||
|
|
||||||
|
@ -53,19 +48,13 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
{
|
{
|
||||||
const VIA *via = static_cast<const VIA *>( aTrackItem );
|
const VIA *via = static_cast<const VIA *>( aTrackItem );
|
||||||
|
|
||||||
// Micro vias have a size only defined in their netclass
|
// Get the drill value, regardless it is default or specific
|
||||||
// (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
|
|
||||||
initial_drill = via->GetDrillValue();
|
initial_drill = via->GetDrillValue();
|
||||||
|
|
||||||
if( net )
|
if( aUseNetclassValue || via->GetViaType() == VIATYPE::MICROVIA )
|
||||||
{
|
{
|
||||||
new_width = net->GetViaSize();
|
new_width = aTrackItem->GetNetClass()->GetViaDiameter();
|
||||||
new_drill = net->GetViaDrillSize();
|
new_drill = aTrackItem->GetNetClass()->GetViaDrill();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -73,19 +62,6 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
new_drill = GetDesignSettings().GetCurrentViaDrill();
|
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
|
// 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
|
// 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
|
// 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
|
// Set new drill value. Note: currently microvias have only a default drill value
|
||||||
VIA *via = static_cast<VIA *>( aTrackItem );
|
VIA *via = static_cast<VIA *>( aTrackItem );
|
||||||
|
|
||||||
if( new_drill > 0 )
|
if( new_drill > 0 )
|
||||||
via->SetDrill( new_drill );
|
via->SetDrill( new_drill );
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -136,83 +136,6 @@ public:
|
||||||
return m_netClass ? m_netClass->GetName() : NETCLASS::Default;
|
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
|
* Function GetNet
|
||||||
* @return int - the netcode
|
* @return int - the netcode
|
||||||
|
|
|
@ -2328,15 +2328,11 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
||||||
// else error: will be removed later
|
// else error: will be removed later
|
||||||
via->SetLayerPair( first_layer, last_layer );
|
via->SetLayerPair( first_layer, last_layer );
|
||||||
|
|
||||||
// Update diameter and hole size, which where set previously
|
// Update diameter and hole size, which where set previously for normal vias
|
||||||
// for normal vias
|
NETCLASS* netClass = via->GetNetClass();
|
||||||
NETINFO_ITEM* net = via->GetNet();
|
|
||||||
|
|
||||||
if( net )
|
via->SetWidth( netClass->GetuViaDiameter() );
|
||||||
{
|
via->SetDrill( netClass->GetuViaDrill() );
|
||||||
via->SetWidth( net->GetMicroViaSize() );
|
|
||||||
via->SetDrill( net->GetMicroViaDrillSize() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -675,10 +675,10 @@ int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( via->GetViaType() == VIATYPE::MICROVIA )
|
if( via->GetViaType() == VIATYPE::MICROVIA )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* net = via->GetNet();
|
NETCLASS* netClass = via->GetNetClass();
|
||||||
|
|
||||||
new_width = net->GetMicroViaSize();
|
new_width = netClass->GetuViaDiameter();
|
||||||
new_drill = net->GetMicroViaDrillSize();
|
new_drill = netClass->GetuViaDrill();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue