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
BIN
View File
Binary file not shown.
+3
View File
@@ -128,6 +128,7 @@ static const std::string GVAR_AUXAXES = ".AuxAxes" ; // (int) numero ass
static const std::string GVAR_AN = ".AN" ; // (num) valore del N-esimo asse ausiliario per simulazione
static const std::string GVAR_ANN = ".ANn" ; // (string) nome del N-esimo asse ausiliario per simulazione
static const std::string GVAR_VMILL = ".VMILL" ; // (int) identificativo Zmap attivo
static const std::string GVAR_SIM1ST = ".SIM1ST" ; // (bool) flag inizio simulazione
// Funzioni generazione
static const std::string ON_START = "OnStart" ;
@@ -152,6 +153,8 @@ static const std::string ON_RAPID = "OnRapid" ;
static const std::string ON_LINEAR = "OnLinear" ;
static const std::string ON_ARC = "OnArc" ;
// Funzioni simulazione
static const std::string ON_SIMUL_START = "OnSimulStart" ;
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
static const std::string ON_SIMUL_DISPOSITION_START = "OnSimulDispositionStart" ;
static const std::string ON_SIMUL_DISPOSITION_END = "OnSimulDispositionEnd" ;
+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
+2
View File
@@ -56,6 +56,8 @@ class Simulator
bool GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA) ;
bool ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF) ;
bool OnStart( bool bFirst) ;
bool OnEnd( void) ;
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,