diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 26c25835e1..3e051c76b9 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -991,8 +991,6 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai if( m_shove->HeadsModified() ) newHead = m_shove->GetModifiedHead( 0 ); - OPTIMIZER optimizer( m_currentNode ); - if( newHead.EndsWithVia() ) { PNS_DBG( Dbg(), AddPoint, newHead.Via().Pos(), GREEN, 1000000, "shove-via-preopt" ); @@ -1005,9 +1003,8 @@ bool LINE_PLACER::rhShoveOnly( const VECTOR2I& aP, LINE& aNewHead, LINE& aNewTai if( newHead.EndsWithVia() ) aNewHead.AppendVia( newHead.Via() ); - optimizer.SetEffortLevel( effort ); - optimizer.SetCollisionMask( ITEM::ANY_T ); - optimizer.Optimize( &aNewHead ); + OPTIMIZER::Optimize( &aNewHead, effort, m_currentNode ); + PNS_DBG( Dbg(), AddItem, aNewHead.Clone(), GREEN, 1000000, "head-sh-postopt" ); return true; } diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index f1781a248d..ada14a0edf 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -1103,7 +1103,7 @@ bool OPTIMIZER::runSmartPads( LINE* aLine ) } -bool OPTIMIZER::Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV ) +bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV ) { OPTIMIZER opt( aWorld ); @@ -1113,7 +1113,8 @@ bool OPTIMIZER::Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld, con if( aEffortLevel & OPTIMIZER::PRESERVE_VERTEX ) opt.SetPreserveVertex( aV ); - return opt.Optimize( aLine ); + LINE tmp( *aLine ); + return opt.Optimize( &tmp, aLine ); } diff --git a/pcbnew/router/pns_optimizer.h b/pcbnew/router/pns_optimizer.h index 5458d057e2..a53f16f3b8 100644 --- a/pcbnew/router/pns_optimizer.h +++ b/pcbnew/router/pns_optimizer.h @@ -113,7 +113,7 @@ public: ~OPTIMIZER(); ///< A quick shortcut to optimize a line without creating and setting up an optimizer. - static bool Optimize( const LINE* aLine, int aEffortLevel, NODE* aWorld, + static bool Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VECTOR2I& aV = VECTOR2I(0, 0) ); bool Optimize( const LINE* aLine, LINE* aResult = nullptr, LINE* aRoot = nullptr );