From e48f58aa24f9eb1dd03a88774794757e90cbc526 Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Sun, 27 Jul 2014 15:00:39 -0400 Subject: [PATCH 1/2] Fixed divide-by-zero in D_PAD::ViewGetLOD() --- pcbnew/class_pad.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index bd20fd83af..8349d79577 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -965,6 +965,11 @@ unsigned int D_PAD::ViewGetLOD( int aLayer ) const // Netnames will be shown only if zoom is appropriate if( IsNetnameLayer( aLayer ) ) { + // Pad sizes can be zero briefly when someone is typing a number like "0.5" in the pad properties dialog. + // Fail gracefully if this happens. + if( (m_Size.x == 0) && (m_Size.y == 0) ) + return UINT_MAX; + return ( 100000000 / std::max( m_Size.x, m_Size.y ) ); } From bfbd7ae4b8d07bc5eca8d6a60a0797865c4c67eb Mon Sep 17 00:00:00 2001 From: Andrew Zonenberg Date: Sun, 27 Jul 2014 15:01:06 -0400 Subject: [PATCH 2/2] Push-and-shove router now handles existing blind/buried vias properly. Can't yet create new ones. --- pcbnew/router/pns_router.cpp | 12 ++++++++---- pcbnew/router/pns_via.cpp | 1 + pcbnew/router/pns_via.h | 17 ++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) 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