diff --git a/MachMgrDBTools.cpp b/MachMgrDBTools.cpp index 78ec7f6..e3b74c7 100644 --- a/MachMgrDBTools.cpp +++ b/MachMgrDBTools.cpp @@ -667,6 +667,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC bool bOk = ExeLuaSetGlobIntVar( "TOOL.TYPE", nType) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TIPFEED", dTipFeed) ; + bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ; switch ( nType) { case TT_DRILL_STD : case TT_DRILL_LONG : @@ -762,6 +763,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx pTdata->GetParam( TPA_DIST, dDist) ; double dSpeed = 0 ; pTdata->GetParam( TPA_SPEED, dSpeed) ; + string sUserNotes ; + pTdata->GetParam( TPA_USERNOTES, sUserNotes) ; // Imposto contesto per il disegno utensile if ( ! ExeSetCurrentContext( nToolCtx)) return TD_INT_ERR ; @@ -772,6 +775,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ; + bOk = bOk && ExeLuaSetGlobStringVar( "TOOL.USERNOTES", sUserNotes) ; // Eseguo aggiornamento utensile bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ; // Recupero errore diff --git a/Machine.h b/Machine.h index dcf644c..b33655a 100644 --- a/Machine.h +++ b/Machine.h @@ -262,6 +262,7 @@ class Machine bool AdjustExitFrames( int nLay, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir) ; bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ; bool ModifyMachineExitPosition( const std::string& sHead, int nExit, const Point3d& ptPos) ; + bool ClearKinematicChain( void) ; bool CalculateKinematicChain( void) ; bool AddKinematicAxis( bool bOnHead, int nId) ; bool GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, diff --git a/MachineAxes.cpp b/MachineAxes.cpp index 33327f6..b6b10f8 100644 --- a/MachineAxes.cpp +++ b/MachineAxes.cpp @@ -138,6 +138,15 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p double dCurrVal = pAx->GetCurrVal() ; // limiti della corsa STROKE Stroke = pAx->GetStroke() ; + // se rotante e corrente, verifico se ci sono limitazioni aggiuntive (dalla testa) + if ( ! bLinear) { + for ( const auto& CalcRotAx : m_vCalcRotAx) { + if ( CalcRotAx.nGrpId == nAxGrp) { + Stroke.Min = max( Stroke.Min, CalcRotAx.stroke.Min) ; + Stroke.Max = min( Stroke.Max, CalcRotAx.stroke.Max) ; + } + } + } // recupero il vettore dell'asse int nV = m_pGeomDB->GetFirstNameInGroup( nAxGrp, sAxis) ; const IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ; @@ -146,8 +155,9 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p Point3d ptPos = pGV->GetBase() ; Vector3d vtDir = pGV->GetVector() ; vtDir.Normalize() ; - // limito il movimento alla corsa dell'asse - dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ; + // se richiesto, limito il movimento alla corsa dell'asse + if ( bInStroke) + dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ; // eseguo il movimento if ( bLinear) m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ; diff --git a/MachineCalc.cpp b/MachineCalc.cpp index d7e1b2e..b2682a6 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -481,11 +481,8 @@ Machine::GetCurrHeadCollGroups( INTVECTOR& vIds) const //---------------------------------------------------------------------------- bool -Machine::CalculateKinematicChain( void) +Machine::ClearKinematicChain( void) { - // controllo GeomDB - if ( m_pGeomDB == nullptr) - return false ; // azzero tutti gli assi della catena cinematica m_nTabLinAxes = 0 ; m_nTabRotAxes = 0 ; @@ -497,6 +494,18 @@ Machine::CalculateKinematicChain( void) m_frLinAx.Reset( false) ; m_frRobot.Reset( false) ; m_nCalcChainType = KIN_CHAIN_NONE ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +Machine::CalculateKinematicChain( void) +{ + // controllo GeomDB + if ( m_pGeomDB == nullptr) + return false ; + // azzero tutti gli assi della catena cinematica + ClearKinematicChain() ; // recupero gli assi di tavola if ( m_nCalcTabId == GDB_ID_NULL) return false ; diff --git a/Operation.cpp b/Operation.cpp index 34b38ff..caf0f60 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -2626,7 +2626,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) { // recupero posizione iniziale lavorazione DBLVECTOR vAxIni ; - if ( ! GetInitialAxesValues( true, vAxIni)) + if ( ! GetInitialAxesValues( false, vAxIni)) return false ; // eseguo verifica if ( ! ManageProtectedAreas( vAxVal, vAxIni, nullptr, this, bClimbDone)) @@ -2865,7 +2865,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) // per nuova gestione collegamenti, verifica aree protette if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) { // recupero posizione finale lavorazione - if ( ! pPrevOp->GetFinalAxesValues( true, vAxVal)) + if ( ! pPrevOp->GetFinalAxesValues( false, vAxVal)) return false ; // recupero posizione home DBLVECTOR vAxIni ; @@ -2889,7 +2889,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) { // recupero posizione iniziale lavorazione DBLVECTOR vAxIni ; - if ( ! GetInitialAxesValues( true, vAxIni)) + if ( ! GetInitialAxesValues( false, vAxIni)) return false ; // eseguo verifica if ( ! ManageProtectedAreas( vAxVal, vAxIni, nullptr, this, bClimbDone)) @@ -2923,7 +2923,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) // per nuova gestione collegamenti, verifica aree protette if ( bVerifyPreviousLink && bNewLink && m_pMchMgr->GetCurrIsCenter()) { // recupero posizione finale lavorazione - if ( ! GetFinalAxesValues( true, vAxVal)) + if ( ! GetFinalAxesValues( false, vAxVal)) return false ; // recupero posizione home DBLVECTOR vAxIni ; @@ -2944,91 +2944,113 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink) //---------------------------------------------------------------------------- bool -Operation::ManageProtectedAreas( const DBLVECTOR& vAxVal, const DBLVECTOR& vAxIni, Operation* pPrevOp, Operation* pNextOp, +Operation::ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) { // se non ci sono aree protette, esco subito. if ( ! m_pMchMgr->GetCurrMachine()->ExistProtectedAreas()) return true ; + // il numero di assi non deve cambiare + if ( vAxStart.size() != vAxEnd.size()) + return false ; + int nAxisTot = int( vAxStart.size()) ; + // recupero flag nuova gestione collegamenti tra lavorazioni bool bNewLink = m_pMchMgr->GetCurrMachine()->GetNewLinkMgr() ; - // verifico se il collegamento le attraversa + // Verifico se il collegamento le attraversa + Point3d ptSta( vAxStart[0], vAxStart[1], vAxStart[2]) ; + Point3d ptEnd( vAxEnd[0], vAxEnd[1], vAxEnd[2]) ; + DBLVECTOR vAngSta ; + for ( int i = 3 ; i < int( vAxStart.size()) && bNewLink ; ++ i) + vAngSta.emplace_back( vAxStart[i]) ; + DBLVECTOR vAngEnd ; + for ( int i = 3 ; i < int( vAxEnd.size()) && bNewLink ; ++ i) + vAngEnd.emplace_back( vAxEnd[i]) ; + // verifico inizio e fine + int nOutstroke = 0 ; + int nStSta = 0 ; + if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptSta.x, ptSta.y, ptSta.z, vAngSta, true, nStSta) || nStSta != 0) + nOutstroke |= 2 ; + int nStEnd = 0 ; + if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptEnd.x, ptEnd.y, ptEnd.z, vAngEnd, true, nStEnd) || nStEnd != 0) + nOutstroke |= 1 ; + // verifico i punti intermedi const double PA_VERIF_LEN = 10 ; - Point3d ptStart( vAxVal[0], vAxVal[1], vAxVal[2]) ; - Point3d ptEnd( vAxIni[0], vAxIni[1], vAxIni[2]) ; - double dLen = DistXY( ptStart, ptEnd) ; - int nStep = int( dLen / PA_VERIF_LEN + 1) ; - bool bOutstroke = false ; - for ( int i = 0 ; i <= nStep ; ++ i) { + double dLen = DistXY( ptSta, ptEnd) ; + int nStep = int( dLen / PA_VERIF_LEN) + 1 ; + for ( int i = 1 ; i < nStep && nOutstroke == 0 ; ++ i) { double dCoeff = double( i) / nStep ; - Point3d ptCurr = Media( ptStart, ptEnd, dCoeff) ; + Point3d ptCurr = Media( ptSta, ptEnd, dCoeff) ; DBLVECTOR vAng ; - int nRotAxisNum = int( vAxVal.size()) - 3 ; - if ( bNewLink && nRotAxisNum > 0) { - vAng.resize( nRotAxisNum) ; - for ( int j = 0 ; j < nRotAxisNum ; ++ j) - vAng[j] = ( 1 - dCoeff) * vAxVal[j+3] + dCoeff * vAxIni[j+3] ; - } + for ( int j = 0 ; j < int( vAngSta.size()) ; ++ j) + vAng.emplace_back( ( 1 - dCoeff) * vAngSta[j] + dCoeff * vAngEnd[j]) ; int nStat = 0 ; - if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, vAng, true, nStat) || nStat != 0) { - bOutstroke = true ; - break ; - } + if ( ! m_pMchMgr->GetCurrMachine()->VerifyProtectedAreas( ptCurr.x, ptCurr.y, ptCurr.z, vAng, true, nStat) || nStat != 0) + nOutstroke |= 4 ; } - if ( ! bOutstroke) + if ( nOutstroke == 0) return true ; + // assegno valori assi iniziali e finali, depurati di approcci/retrazioni aggiuntive (CLIMB e RISE) in area protetta + DBLVECTOR vNeatAxSta ; + if ( bNewLink && pPrevOp && ( nOutstroke & 2) != 0) + pPrevOp->GetFinalAxesValues( true, vNeatAxSta) ; + else + vNeatAxSta = vAxStart ; + DBLVECTOR vNeatAxEnd ; + if ( bNewLink && pNextOp && ( nOutstroke & 1) != 0) + pNextOp->GetInitialAxesValues( true, vNeatAxEnd) ; + else + vNeatAxEnd = vAxEnd ; + if ( int( vNeatAxSta.size()) != nAxisTot || int( vNeatAxEnd.size()) != nAxisTot) + return false ; + // chiamo funzione script OnSpecialRapidMove per avere posizioni di movimento int nLinkType = 0 + ( pPrevOp == nullptr ? 0 : 2) + ( pNextOp == nullptr ? 0 : 1) ; POSVECTOR vPosNew ; - bool bModif = false ; - int nErase = 0 ; - bool bOk = ( SpecialMoveRapid( vAxVal, vAxIni, nLinkType, vPosNew, bModif, nErase) && bModif) ; - // se tutto bene, eseguo cancellazioni e einserimenti come richiesto + bool bOk = SpecialMoveRapid( vNeatAxSta, vNeatAxEnd, nOutstroke, nLinkType, vPosNew) ; + // se tutto bene, eseguo cancellazioni e inserimenti come richiesto if ( bOk) { + bClimbDone = bNewLink ; // eventuali cancellazioni - if ( ( nErase & 2) != 0) { - if ( pPrevOp == nullptr) - return false ; + if ( bNewLink && ( nOutstroke & 2) != 0 && pPrevOp != nullptr) pPrevOp->RemoveRise() ; - } - if ( ( nErase & 1) != 0) { - if ( pNextOp == nullptr) - return false ; + if ( bNewLink && ( nOutstroke & 1) != 0 && pNextOp != nullptr) pNextOp->RemoveClimb() ; - bClimbDone = true ; - } // eventuali inserimenti for ( const auto& PosNew : vPosNew) { if ( PosNew.nSide == 2) { - if ( pPrevOp == nullptr) - return false ; - if ( ! pPrevOp->AddSpecialRise( PosNew.vAxis, true, GDB_ID_NULL, PosNew.nFlag, PosNew.nFlag2, PosNew.nMask)) + if ( pPrevOp == nullptr || + ! pPrevOp->AddSpecialRise( PosNew.vAxis, true, GDB_ID_NULL, + PosNew.nFlag, PosNew.nFlag2, PosNew.nMask, PosNew.sInfo)) return false ; } - else if ( PosNew.nSide == 1) { - if ( pNextOp == nullptr) - return false ; - if ( ! pNextOp->AddSpecialClimb( PosNew.vAxis, true, GDB_ID_NULL, PosNew.nFlag, PosNew.nFlag2, PosNew.nMask)) - return false ; - } - else + else if ( PosNew.nSide != 1) return false ; } + for ( int i = int( vPosNew.size()) - 1 ; i >= 0 ; --i) { + const auto& PosNew = vPosNew[i] ; + if ( PosNew.nSide == 1) { + if ( pNextOp == nullptr || + ! pNextOp->AddSpecialClimb( PosNew.vAxis, true, GDB_ID_NULL, + PosNew.nFlag, PosNew.nFlag2, PosNew.nMask, PosNew.sInfo)) + return false ; + } + } } // altrimenti eseguo inserimento con segnalazione di errore else { if ( pPrevOp != nullptr) { - if ( ! pPrevOp->AddSpecialRise( vAxVal, false)) + if ( ! pPrevOp->AddSpecialRise( vAxStart, false)) return false ; } - else if ( pNextOp != nullptr) { - if ( ! pNextOp->AddSpecialClimb( vAxIni, false)) + if ( pNextOp != nullptr) { + if ( ! pNextOp->AddSpecialClimb( vAxEnd, false)) return false ; } - else + if ( pPrevOp == nullptr && pNextOp == nullptr) return false ; } @@ -3379,8 +3401,10 @@ Operation::ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const } //---------------------------------------------------------------------------- +// Inserisce sempre prima della prima entità del percorso bool -Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int nFlag, int nFlag2, int nMask) +Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, + int nFlag, int nFlag2, int nMask, const string& sInfo) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; @@ -3399,12 +3423,8 @@ Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, in if ( nClPathId == GDB_ID_NULL) return false ; } - // cerco la prima entità del percorso che non sia CLIMB - int nEntId = m_pGeomDB->GetLastNameInGroup( nClPathId, MCH_CL_CLIMB) ; - if ( nEntId == GDB_ID_NULL) - nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ; - else - nEntId = m_pGeomDB->GetNext( nEntId) ; + // cerco la prima entità del percorso + int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ; if ( nEntId == GDB_ID_NULL) return false ; // ne recupero i dati Cam @@ -3417,7 +3437,7 @@ Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, in return false ; // assegno le coordinate del punto pGP->Set( pCamData->GetEndPoint()) ; - // inserisco l'oggetto nel DB geometrico prima della prima entità non CLIMB + // inserisco l'oggetto nel DB geometrico prima della prima entità int nId = m_pGeomDB->InsertGeoObj( GDB_ID_NULL, nEntId, GDB_BEFORE, Release( pGP)) ; if ( nId == GDB_ID_NULL) return false ; @@ -3436,6 +3456,19 @@ Operation::AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, in pCam->SetFlag2( nFlag2) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; + // inserzione eventuali info + if ( ! IsEmptyOrSpaces( sInfo)) { + STRVECTOR vsTokens ; + Tokenize( sInfo, ";", vsTokens) ; + for ( const auto& sToken : vsTokens) { + if ( ! IsEmptyOrSpaces( sToken)) { + string sKey, sVal ; + SplitFirst( sToken, "=", sKey, sVal) ; + if ( ! IsEmptyOrSpaces( sKey)) + m_pGeomDB->SetInfo( nId, sKey, sVal) ; + } + } + } return true ; } @@ -3634,8 +3667,10 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId, int nToMinM } //---------------------------------------------------------------------------- +// Inserisce sempre dopo l'ultima entità del percorso bool -Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int nFlag, int nFlag2, int nMask) +Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, + int nFlag, int nFlag2, int nMask, const string& sInfo) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; @@ -3687,6 +3722,20 @@ Operation::AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk, int nClPathId, int pCam->SetFlag2( nFlag2) ; // associo questo oggetto a quello geometrico m_pGeomDB->SetUserObj( nId, Release( pCam)) ; + // inserzione eventuali info + if ( ! IsEmptyOrSpaces( sInfo)) { + STRVECTOR vsTokens ; + Tokenize( sInfo, ";", vsTokens) ; + for ( const auto& sToken : vsTokens) { + if ( ! IsEmptyOrSpaces( sToken)) { + string sKey, sVal ; + SplitFirst( sToken, "=", sKey, sVal) ; + if ( ! IsEmptyOrSpaces( sKey)) + m_pGeomDB->SetInfo( nId, sKey, sVal) ; + } + string sKey, sVal ; + } + } return true ; } @@ -4717,8 +4766,8 @@ Operation::SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nF //---------------------------------------------------------------------------- bool -Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType, - POSVECTOR& vNewPos, bool& bModif, int& nErase) +Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType, + POSVECTOR& vNewPos) { // recupero la macchina corrente Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ; @@ -4726,21 +4775,17 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, return false ; // costanti static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo - static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=FinePrec, 2=InizioSucc, 3=Entrambi)) - static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok) - static const string EVAR_MODIF = ".MODIF" ; // OUT (bool) flag di modifica effettuata - static const string EVAR_ERASE = ".ERASE" ; // OUT (int) codice di rimozione movimenti RISE/CLIMB + static const string EVAR_OUTSTROKE = ".OUTSTROKE" ; // IN (int) codice extracorsa posizioni (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)) + static const string EVAR_LINKTYPE = ".LINKTYPE" ; // IN (int) codice tipo collegamento (1=Inizio, 2=Fine, 3=FinePrec+InizioSucc)) + static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok) static const string EVAR_POSTOT = ".POSTOT" ; // OUT (int) numero di nuove posizioni static const string EVAR_POS = ".POS" ; // OUT (table) vettore di posizioni - static const string EVAR_SIDE = ".SIDE" ; // OUT (int) codice inserimento movimento (-1=prec, 1=curr) + static const string EVAR_SIDE = ".SIDE" ; // OUT (int) codice inserimento movimento (1=Inizio, 2=Fine) static const string ON_SPECIAL_MOVERAPID = "OnSpecialMoveRapid" ; // se la funzione non è definita, esco - if ( ! pMch->LuaExistsFunction( ON_SPECIAL_MOVERAPID)) { - bModif = false ; - nErase = 0 ; - return true ; - } + if ( ! pMch->LuaExistsFunction( ON_SPECIAL_MOVERAPID)) + return false ; // eseguo bool bOk = true ; @@ -4753,6 +4798,7 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TCPOS, GetToolTcPos()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_MCHID, GetOwner()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_PHASE, m_nPhase) ; + bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OUTSTROKE, ( nOutstroke % 4)) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_LINKTYPE, nLinkType) ; // valore degli assi bool bIsRobot = m_pMchMgr->GetCurrIsRobot() ; @@ -4765,10 +4811,7 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID, false) ; // recupero valori parametri obbligatori bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ; - bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MODIF, bModif) ; // recupero i parametri facoltativi - if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERASE, nErase)) - nErase = 0 ; int nPosTot ; if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_POSTOT, nPosTot)) nPosTot = -1 ; @@ -4805,6 +4848,8 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, CurrPos.nFlag = 0 ; if ( ! pMch->LuaGetGlobVar( sRec + GVAR_FLAG2, CurrPos.nFlag2)) CurrPos.nFlag2 = 0 ; + if ( ! pMch->LuaGetGlobVar( sRec + GVAR_INFO, CurrPos.sInfo)) + CurrPos.sInfo = "" ; vNewPos.emplace_back( CurrPos) ; } } diff --git a/Operation.h b/Operation.h index e5fbaa5..faa6fee 100644 --- a/Operation.h +++ b/Operation.h @@ -116,11 +116,12 @@ class Operation : public IUserObj protected : struct Position { - int nSide ; - DBLVECTOR vAxis ; - int nFlag ; - int nFlag2 ; - int nMask ; + int nSide ; + DBLVECTOR vAxis ; + int nFlag ; + int nFlag2 ; + int nMask ; + std::string sInfo ; Position() : nSide( 0), nFlag( 0), nFlag2( 0), nMask( -1) {} } ; typedef std::vector POSVECTOR ; @@ -209,15 +210,15 @@ class Operation : public IUserObj bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ; - bool ManageProtectedAreas( const DBLVECTOR& vAxVal, const DBLVECTOR& vAxIni, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ; + bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ; bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ; bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ; bool AddSpecialClimb( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, - int nFlag = 0, int nFlag2 = 0, int nMask = -1) ; + int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ; bool RemoveClimb( int nClPathId = GDB_ID_NULL) ; bool AddRise( DBLVECTOR& vAxVal, double dDelta = NAN, int nClPathId = GDB_ID_NULL, int nToMinMaxZ = 0) ; bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, - int nFlag = 0, int nFlag2 = 0, int nMask = -1) ; + int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ; bool RemoveRise( int nClPathId = GDB_ID_NULL) ; bool AddHome( void) ; bool RemoveClimbRiseHome( void) ; @@ -239,8 +240,8 @@ class Operation : public IUserObj bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ; - bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nLinkType, - POSVECTOR& vNewPos, bool& bModif, int& nErase) ; + bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType, + POSVECTOR& vNewPos) ; bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ; bool IsAggrBottom( const std::string& sHead) const ;