EgtMachKernel 1.6u1 :

- aggiunto richiamo di OnSimulDispositionStarting con nuova disposizione in simulazione.
This commit is contained in:
Dario Sassi
2016-09-12 06:43:33 +00:00
parent 50a3ab4ebf
commit 381d58494d
5 changed files with 36 additions and 3 deletions
+32 -2
View File
@@ -208,8 +208,6 @@ Simulator::Move( int& nStatus)
// se disposizione con cambio di fase
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( 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,