diff --git a/CamData.h b/CamData.h index a410ed1..96bf94c 100644 --- a/CamData.h +++ b/CamData.h @@ -72,6 +72,8 @@ class CamData : public IUserObj { m_bToolShow = bShow ; return true ; } int GetMoveType( void) const { return m_nMove ; } + bool IsRapid( void) const + { return ( m_nMove == 0) ; } bool IsLine( void) const { return ( m_nMove == 0 || m_nMove == 1) ; } bool IsArc( void) const diff --git a/Operation.cpp b/Operation.cpp index 8ebaf6d..665c8f5 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -2722,6 +2722,37 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinFor nFlag2Prec = pCamData->GetFlag2() ; bToolShowPrec = pCamData->GetToolShow() ; } + // controllo la continuità del movimento + const double MAX_DELTA_ANG = 45 ; + bool bRotContOnNext = ( GetType() != OPER_DISP) ; + int nInd = 0 ; + int nCount = m_pGeomDB->GetGroupObjs( nClPathId) ; + const DBLVECTOR* pvPrevAxVal = nullptr ; + for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ; + nEntId != GDB_ID_NULL ; + nEntId = m_pGeomDB->GetNext( nEntId)) { + // indice del movimento + ++ nInd ; + // recupero i dati Cam dell'entità + CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ; + if ( pCamData == nullptr) + continue ; + const DBLVECTOR& vCurrAxVal = pCamData->GetAxesVal() ; + // se movimento di lavoro ed esiste precedente, li confronto + if ( ! pCamData->IsRapid() && pvPrevAxVal != nullptr) { + // Se richiesta continuità, verifico non ci siano salti + double dDeltaR4 = vCurrAxVal[3] - (*pvPrevAxVal)[3] ; + double dDeltaR6 = vCurrAxVal[5] - (*pvPrevAxVal)[5] ; + if ( bRotContOnNext && ( abs( dDeltaR4) > MAX_DELTA_ANG || abs( dDeltaR6) > MAX_DELTA_ANG)) { + string sOut = "Lost continuity on R4 (Diff=" + ToString( dDeltaR4, 1) + + ") or R6 (Diff=" + ToString( dDeltaR6, 1) + + ") at move " + ToString( nInd) + " of " + ToString( nCount) ; + m_pMchMgr->SetWarning( 1101, sOut) ; + } + } + // salvo nuovi precedenti + pvPrevAxVal = &vCurrAxVal ; + } return bOk ; }