From 74a5047b6b2d97f0838b7c634d6260ef8d9b8eca Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 9 Nov 2017 12:16:28 +0000 Subject: [PATCH] EgtMachKernel 1.8k1 : - in simulazione passato parametro EMT.SBH a OnDispositionStarting e OnDispositionStart. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Simulator.cpp | 29 ++++++++++++++++++++--------- Simulator.h | 4 ++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 65a7dc42c67a3c23d1f875f5101636c5bfac05f2..5b092221bd18e5910591c827f5729107a7f2b67f 100644 GIT binary patch delta 121 zcmZpRX^YwLgN@aYL5IO`^ItY=X69@L!^w`qx|_3v+!!~nNOI~D}d`2)2NkJbA OTnNOI~D}d`2)2NkJbA OTnGetTable( 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) ;