diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 65a7dc4..5b09222 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/Simulator.cpp b/Simulator.cpp index 0ed13a7..f9686a9 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -547,15 +547,20 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) pDisp->GetTable( sTable) ; Point3d ptOri1 ; pDisp->GetTableRef1( ptOri1) ; + // recupero la fase della disposizione + int nPhase = pDisp->GetPhase() ; + // recupero se con movimenti autonomi + bool bEmpty = pDisp->IsEmpty() ; + // recupero flag disposizione con movimenti manuali + bool bSomeByHand = pDisp->GetSomeByHand() ; // se con movimenti autonomi - if ( ! pDisp->IsEmpty()) { + if ( ! bEmpty) { // richiamo gestione evento appena prima di inizio disposizione - if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, false)) { + if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) { nStatus = MCH_SIM_ERR ; return false ; } // cambio fase - int nPhase = pDisp->GetPhase() ; m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ; // aggiorno utensile e assi conseguenti if ( ! UpdateTool( bFirst)) { @@ -564,25 +569,27 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus) } ++ m_nOpInd ; // richiamo gestione evento inizio disposizione - if ( ! OnDispositionStart( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, false)) { + if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, false, bSomeByHand)) { nStatus = MCH_SIM_ERR ; return false ; } + // se ci sono movimenti manuali, aggiorno visualizzazione e breve pausa (200 ms) + if ( bSomeByHand) + Sleep( 200) ; break ; } // altrimenti disposizione passiva else { // richiamo gestione evento appena prima di inizio disposizione - if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, true)) { + if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand)) { nStatus = MCH_SIM_ERR ; return false ; } // cambio fase - int nPhase = pDisp->GetPhase() ; m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ; ++ m_nOpInd ; // richiamo gestione evento inizio e fine disposizione - if ( ! OnDispositionStart( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, true) || + if ( ! OnDispositionStart( m_nOpId, m_nOpInd, nPhase, sTable, ptOri1, true, bSomeByHand) || ! OnDispositionEnd()) { nStatus = MCH_SIM_ERR ; return false ; @@ -890,7 +897,7 @@ Simulator::ManageMove( int& nStatus) //---------------------------------------------------------------------------- bool Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase, - const string& sTable, const Point3d& ptOri1, bool bEmpty) + const string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) { // assegno identificativo e indice disposizione bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ; @@ -902,6 +909,8 @@ Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase, bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABORI1, ptOri1) ; // assegno flag disposizione passiva bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ; + // assegno flag disposizione con operazioni manuali + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SBH, bSomeByHand) ; // verifico esistenza funzione if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_DISPOSITION_STARTING)) return true ; @@ -915,7 +924,7 @@ Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase, //---------------------------------------------------------------------------- bool Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, - const string& sTable, const Point3d& ptOri1, bool bEmpty) + const string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) { // assegno identificativo e indice disposizione bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ; @@ -927,6 +936,8 @@ Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABORI1, ptOri1) ; // assegno flag disposizione passiva bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ; + // assegno flag disposizione con operazioni manuali + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SBH, bSomeByHand) ; // verifico esistenza funzione if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_DISPOSITION_START)) return true ; diff --git a/Simulator.h b/Simulator.h index 8466c9c..0499166 100644 --- a/Simulator.h +++ b/Simulator.h @@ -54,9 +54,9 @@ class Simulator bool ManagePathEndAux( int& nStatus) ; bool ManageMove( int& nStatus) ; bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase, - const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ; + const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ; bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, - const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ; + const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ; bool OnDispositionEnd( void) ; bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos, bool bFirst) ; bool OnToolDeselect( const std::string& sNextTool, const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;