From 381d58494d1e7a8c7ebf7a67edc017f315c30787 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 12 Sep 2016 06:43:33 +0000 Subject: [PATCH] EgtMachKernel 1.6u1 : - aggiunto richiamo di OnSimulDispositionStarting con nuova disposizione in simulazione. --- EgtMachKernel.rc | Bin 11782 -> 11782 bytes Milling.cpp | 2 +- OutputConst.h | 1 + Simulator.cpp | 34 ++++++++++++++++++++++++++++++++-- Simulator.h | 2 ++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index bb2d97c3e954df2cba5994ac830c1e60b44db95b..e0a455deac9f9b2c9c3054f1830c9b77bdd005a7 100644 GIT binary patch delta 121 zcmZpRX^YwLgN@aYL5IO`^ItY=X68}`!^w`qx|_3v+!!~nNOI~D}d`2)2NkJbA OTnNOI~D}d`2)2NkJbA OTnGetUserObj( m_nOpId)) ; if ( pDisp != nullptr) { - // cambio fase - m_pMchMgr->SetCurrPhase( pDisp->GetPhase()) ; // recupero dati tavola string sTable ; pDisp->GetTable( sTable) ; @@ -217,6 +215,13 @@ Simulator::Move( int& nStatus) pDisp->GetTableRef1( ptOri1) ; // se con movimenti autonomi if ( ! pDisp->IsEmpty()) { + // richiamo gestione evento appena prima di inizio disposizione + if ( ! OnDispositionStarting( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, false)) { + nStatus = MCH_SIM_ERR ; + return false ; + } + // cambio fase + m_pMchMgr->SetCurrPhase( pDisp->GetPhase()) ; // aggiorno utensile e assi conseguenti if ( ! UpdateTool()) { nStatus = MCH_SIM_ERR ; @@ -234,6 +239,8 @@ Simulator::Move( int& nStatus) } // altrimenti disposizione passiva else { + // cambio fase + m_pMchMgr->SetCurrPhase( pDisp->GetPhase()) ; ++ m_nOpInd ; // richiamo gestione evento inizio e fine disposizione if ( ! OnDispositionStart( m_nOpId, m_nOpInd, pDisp->GetPhase(), sTable, ptOri1, true) || @@ -602,6 +609,29 @@ Simulator::OnOperationEnd( void) return false ; } +//---------------------------------------------------------------------------- +bool +Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase, + const string& sTable, const Point3d& ptOri1, bool bEmpty) +{ + // assegno identificativo e indice disposizione + bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPID, nOpId) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPIND, nOpInd) ; + // assegno nuovo indice di fase + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PHASE, nPhase) ; + // assegno nome e valore riferimento della tavola corrente + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABNAME, sTable) ; + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TABORI1, ptOri1) ; + // assegno flag disposizione passiva + bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ; + // verifico esistenza funzione + if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_DISPOSITION_STARTING)) + return true ; + // chiamo la funzione di inizio disposizione + bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_DISPOSITION_STARTING) ; + return bOk ; +} + //---------------------------------------------------------------------------- bool Simulator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, diff --git a/Simulator.h b/Simulator.h index cfb49d7..67d7357 100644 --- a/Simulator.h +++ b/Simulator.h @@ -43,6 +43,8 @@ class Simulator private : bool OnOperationEnd( void) ; + bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase, + const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ; bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ; bool OnDispositionEnd( void) ;