diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index d9db594a0f..809e4e5e09 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -227,12 +227,15 @@ PNS_ITEM* PNS_ROUTER::syncTrack( TRACK* aTrack ) PNS_ITEM* PNS_ROUTER::syncVia( VIA* aVia ) { + LAYER_ID top, bottom; + aVia->LayerPair(&top, &bottom); PNS_VIA* v = new PNS_VIA( aVia->GetPosition(), - PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ), + PNS_LAYERSET( top, bottom ), aVia->GetWidth(), aVia->GetDrillValue(), - aVia->GetNetCode() ); + aVia->GetNetCode(), + aVia->GetViaType() ); v->SetParent( aVia ); @@ -759,8 +762,9 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) via_board->SetWidth( via->Diameter() ); via_board->SetDrill( via->Drill() ); via_board->SetNetCode( via->Net() ); - via_board->SetLayerPair( ToLAYER_ID( m_settings.GetLayerTop() ), - ToLAYER_ID( m_settings.GetLayerBottom() ) ); + via_board->SetViaType(via->ViaType()); //MUST be before SetLayerPair() + via_board->SetLayerPair( ToLAYER_ID( via->Layers().Start() ), + ToLAYER_ID( via->Layers().End() ) ); newBI = via_board; break; } diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index f7ff5e9461..1b5c369bf2 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -91,6 +91,7 @@ PNS_VIA* PNS_VIA::Clone ( ) const v->m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 ); v->m_rank = m_rank; v->m_marker = m_marker; + v->m_viaType = m_viaType; return v; } diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index dcf7abdf1f..97f33be32e 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -24,6 +24,8 @@ #include #include +#include "../class_track.h" + #include "pns_item.h" class PNS_NODE; @@ -36,7 +38,7 @@ public: {} PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, - int aDiameter, int aDrill, int aNet = -1 ) : + int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) : PNS_ITEM( VIA ) { SetNet( aNet ); @@ -45,6 +47,7 @@ public: m_diameter = aDiameter; m_drill = aDrill; m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 ); + m_viaType = aViaType; } @@ -60,6 +63,7 @@ public: m_rank = aB.m_rank; m_owner = aB.m_owner; m_drill = aB.m_drill; + m_viaType = aB.m_viaType; } const VECTOR2I& Pos() const @@ -73,6 +77,16 @@ public: m_shape.SetCenter( aPos ); } + VIATYPE_T ViaType() const + { + return m_viaType; + } + + void SetViaType(VIATYPE_T aViaType) + { + m_viaType = aViaType; + } + int Diameter() const { return m_diameter; @@ -124,6 +138,7 @@ private: int m_drill; VECTOR2I m_pos; SHAPE_CIRCLE m_shape; + VIATYPE_T m_viaType; }; #endif