diff --git a/Operation.cpp b/Operation.cpp index 775cac0..aa9fe76 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1704,7 +1704,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) while ( bOk && nClPathId != GDB_ID_NULL) { // se richiesta verifica collegamento con lavorazione precedente, sistemo inizio if ( bVerifyPreviousLink) { - if ( ! AdjustOneStartMovement( nClPathId, nPrevClPathId, vAxVal, bMaxZ)) + if ( ! AdjustOneStartMovement( nClPathId, nPrevClPathId, pPrevOp, vAxVal, bMaxZ)) bOk = false ; } bMaxZ = false ; @@ -1731,7 +1731,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) //---------------------------------------------------------------------------- bool -Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ) +Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; @@ -1798,8 +1798,16 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVE } // risalita sopra fine percorso precedente DBLVECTOR vAxNew1 ; - if ( ! AddRise( vAxNew1, dSafeZ - vAxPrev[2], nPrevClPathId)) - return false ; + if ( nPrevClPathId == GDB_ID_NULL) { + if ( pPrevOp == nullptr || + ! pPrevOp->RemoveRise() || + ! pPrevOp->AddRise( vAxNew1, dSafeZ - vAxPrev[2])) + return false ; + } + else { + if ( ! AddRise( vAxNew1, dSafeZ - vAxPrev[2], nPrevClPathId)) + return false ; + } // aggiungo posizione elevata prima dell'inizio del percorso corrente if ( m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) == GDB_ID_NULL) return false ; diff --git a/Operation.h b/Operation.h index ef35b3c..b088ab3 100644 --- a/Operation.h +++ b/Operation.h @@ -101,7 +101,7 @@ class Operation : public IUserObj bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ; - bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ) ; + bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ; bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ; bool RemoveClimb( int nClPathId) ; bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL) ;