diff --git a/SimulatorMP.cpp b/SimulatorMP.cpp index 015f86a..199e4c8 100644 --- a/SimulatorMP.cpp +++ b/SimulatorMP.cpp @@ -1132,6 +1132,16 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove) return false ; } DBLVECTOR AxesEnd = pCamData->GetAxesVal() ; + // Controllo che il numero di valori corrisponda con quello degli assi + int nEndsCnt = int( AxesEnd.size()) ; + int nAxesCnt = int( m_AxesName.size()) ; + if ( nEndsCnt != nAxesCnt) { + nStatus = MCH_SIM_ERR ; + m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ; + string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) + return false ; + } // Tipo di movimento int nMoveType = pCamData->GetMoveType() ; // Se inizio di nuova entità, mascheratura movimento diff --git a/SimulatorSP.cpp b/SimulatorSP.cpp index ca55a0a..413f1fc 100644 --- a/SimulatorSP.cpp +++ b/SimulatorSP.cpp @@ -1055,7 +1055,7 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove) case CamData::AS_OUTSTROKE : { DBLVECTOR OutAxes = pCamData->GetAxesVal() ; if ( ! m_pMchMgr->GetCurrIsRobot()) { - for ( size_t i = OutAxes.size() ; i < 5 ; ++ i) + for ( int i = int( OutAxes.size()) ; i <= 5 ; ++ i) OutAxes.emplace_back( 0) ; DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ; int nStat ; @@ -1075,6 +1075,16 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove) return false ; } DBLVECTOR AxesEnd = pCamData->GetAxesVal() ; + // Controllo che il numero di valori corrisponda con quello degli assi + int nEndsCnt = int( AxesEnd.size()) ; + int nAxesCnt = int( m_AxesName.size()) ; + if ( nEndsCnt != nAxesCnt) { + nStatus = MCH_SIM_ERR ; + m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ; + string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) + return false ; + } // Tipo di movimento int nMoveType = pCamData->GetMoveType() ; // Se inizio di nuova entità, mascheratura movimento