EgtMachKernel 1.9c2 :

- in simulazione aggiunti eventi OnSimulationStart e OnSimulationEnd.
This commit is contained in:
Dario Sassi
2018-02-28 18:05:56 +00:00
parent 6d324ba067
commit 716ffccd16
4 changed files with 35 additions and 1 deletions
+30 -1
View File
@@ -115,6 +115,10 @@ Simulator::Start( bool bFirst)
if ( ! m_pMachine->LuaCreateGlobTable( GLOB_VAR))
bOk = false ;
// Richiamo funzione su avvio simulazione
if ( ! OnStart( bFirst))
bOk = false ;
// Arrivo alla preparazione per la prima lavorazione
int nStatus ;
if ( ! FindAndManageOperationStart( true, bFirst, nStatus))
@@ -185,6 +189,7 @@ Simulator::Move( int& nStatus)
return false ;
// se non ce ne sono altre, sono alla fine
if ( m_nOpId == GDB_ID_NULL) {
OnEnd() ;
nStatus = MCH_SIM_END ;
return false ;
}
@@ -1002,12 +1007,36 @@ Simulator::ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Vec
return pVZM->MillingStep( ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
}
//----------------------------------------------------------------------------
bool
Simulator::OnStart( bool bFirst)
{
// assegno flag inizio simulazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIM1ST, bFirst) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_START))
return true ;
// chiamo la funzione di inizio simulazione
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_START) ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
Simulator::OnEnd( void)
{
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_END))
return true ;
// chiamo la funzione di fine simulazione
return m_pMachine->LuaCallFunction( ON_SIMUL_END) ;
}
//----------------------------------------------------------------------------
bool
Simulator::OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
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) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DISPIND, nOpInd) ;
// assegno nuovo indice di fase