From 8ad89ae457e44e75ddcf300b6617d8296af0c39b Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 24 Dec 2020 17:31:45 -0500 Subject: [PATCH] PNS: fix manual posture mode --- pcbnew/router/pns_line_placer.cpp | 8 +++++--- pcbnew/router/pns_line_placer.h | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 281ee7795b..a00894d62e 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -986,6 +986,7 @@ bool LINE_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem ) m_postureSolver.AddTrailPoint( aP ); m_postureSolver.SetTolerance( m_head.Width() ); m_postureSolver.SetDefaultDirections( m_initial_direction, DIRECTION_45::UNDEFINED ); + m_postureSolver.SetDisabled( !Settings().GetAutoPosture() ); NODE *n; @@ -1409,7 +1410,7 @@ bool LINE_PLACER::buildInitialLine( const VECTOR2I& aP, LINE& aHead ) initial_radius = Settings().GetMaxRadius(); - if( !m_tail.PointCount() && Settings().GetAutoPosture() ) + if( !m_tail.PointCount() ) l = guessedDir.BuildInitialTrace( m_p_start, aP, false, initial_radius ); else l = m_direction.BuildInitialTrace( m_p_start, aP, false, initial_radius ); @@ -1523,8 +1524,9 @@ int FIXED_TAIL::StageCount() const POSTURE_SOLVER::POSTURE_SOLVER() { - m_forced = false; + m_forced = false; m_tolerance = 0; + m_disabled = false; } @@ -1587,7 +1589,7 @@ DIRECTION_45 POSTURE_SOLVER::GetPosture( const VECTOR2I& aP ) // Adjusts how close to p0 we unlock the posture again if one was locked already const int unlockDistanceFactor = 4; - if( m_trail.PointCount() < 2 ) + if( m_disabled || m_trail.PointCount() < 2 ) return m_direction; auto dbg = ROUTER::GetInstance()->GetInterface()->GetDebugDecorator(); diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index 93152a585d..41f553efb0 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.h @@ -93,12 +93,15 @@ public: void FlipPosture(); + void SetDisabled( bool aDisabled = true ) { m_disabled = aDisabled; } + private: SHAPE_LINE_CHAIN m_trail; int m_tolerance; DIRECTION_45 m_direction; - DIRECTION_45 m_lastSegDirection; - bool m_forced; + DIRECTION_45 m_lastSegDirection; + bool m_forced; + bool m_disabled; }; /**