EgtMachKernel :
- modifiche alla simulazione.
This commit is contained in:
@@ -70,6 +70,8 @@ static const std::string GVAR_START = ".START" ; // (Point3d) punto iniz
|
||||
static const std::string GVAR_EXTR = ".EXTR" ; // (Vector3d)versore estrusione
|
||||
static const std::string GVAR_PMIN = ".PMIN" ; // (Point3d) punto minimo di ingombro del percorso di lavorazione
|
||||
static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto massimo di ingombro del percorso di lavorazione
|
||||
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
|
||||
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
|
||||
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
|
||||
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
|
||||
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
|
||||
@@ -147,6 +149,8 @@ static const std::string ON_SIMUL_MACHINING_START = "OnSimulMachiningStart" ;
|
||||
static const std::string ON_SIMUL_MACHINING_END = "OnSimulMachiningEnd" ;
|
||||
static const std::string ON_SIMUL_PATH_START = "OnSimulPathStart" ;
|
||||
static const std::string ON_SIMUL_PATH_END = "OnSimulPathEnd" ;
|
||||
static const std::string ON_SIMUL_PATH_START_AUX = "OnSimulPathStartAux" ;
|
||||
static const std::string ON_SIMUL_PATH_END_AUX = "OnSimulPathEndAux" ;
|
||||
static const std::string ON_SIMUL_MOVE_START = "OnSimulMoveStart" ;
|
||||
static const std::string ON_SIMUL_MOVE_END = "OnSimulMoveEnd" ;
|
||||
// Funzioni macchina
|
||||
|
||||
+95
-3
@@ -342,6 +342,7 @@ Simulator::UpdateTool( bool bForced)
|
||||
bool
|
||||
Simulator::UpdateAxes( void)
|
||||
{
|
||||
ResetAxes() ;
|
||||
// Macchina corrente
|
||||
Machine* pMachine = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMachine == nullptr)
|
||||
@@ -351,9 +352,6 @@ Simulator::UpdateAxes( void)
|
||||
! pMachine->GetAllCurrAxesToken( m_AxesToken))
|
||||
return false ;
|
||||
// Aggiorno flag invertito, il tipo e la posizione corrente degli assi macchina attivi
|
||||
m_AxesInvert.clear() ;
|
||||
m_AxesLinear.clear() ;
|
||||
m_AxesVal.clear() ;
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
bool bInvert ;
|
||||
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
|
||||
@@ -393,7 +391,9 @@ Simulator::ResetAxes( void)
|
||||
// pulisco dati assi
|
||||
m_AxesName.clear() ;
|
||||
m_AxesToken.clear() ;
|
||||
m_AxesInvert.clear() ;
|
||||
m_AxesLinear.clear() ;
|
||||
m_AxesVal.clear() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -560,6 +560,9 @@ Simulator::FindAndManagePathStart( int& nStatus)
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
// gestione eventuali eventi ausiliari prima di percorso
|
||||
if ( ! ManagePathStartAuxes( nStatus))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -569,6 +572,9 @@ Simulator::FindAndManagePathStart( int& nStatus)
|
||||
bool
|
||||
Simulator::ManagePathEnd( int& nStatus)
|
||||
{
|
||||
// gestione eventuali eventi ausiliari dopo percorso
|
||||
if ( ! ManagePathEndAuxes( nStatus))
|
||||
return false ;
|
||||
// richiamo gestione evento fine percorso di lavoro
|
||||
if ( ! OnPathEnd()) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
@@ -577,6 +583,58 @@ Simulator::ManagePathEnd( int& nStatus)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::ManagePathStartAuxes( int& nStatus)
|
||||
{
|
||||
// recupero il numero di eventi ausiliari
|
||||
int nAS ;
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AS#", nAS) || nAS == 0)
|
||||
return true ;
|
||||
// processo gli eventi
|
||||
for ( int i = 1 ; i <= nAS ; ++ i) {
|
||||
// recupero i dati per l'evento
|
||||
string sAS ;
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AS" + ToString( i), sAS)) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
// richiamo gestione evento ausiliario prima di inizio percorso di lavoro
|
||||
if ( ! OnPathStartAux( i, sAS)) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::ManagePathEndAuxes( int& nStatus)
|
||||
{
|
||||
// recupero il numero di eventi ausiliari
|
||||
int nAE ;
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AE#", nAE) || nAE == 0)
|
||||
return true ;
|
||||
// processo gli eventi
|
||||
for ( int i = 1 ; i <= nAE ; ++ i) {
|
||||
// recupero i dati per l'evento
|
||||
string sAE ;
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AE" + ToString( i), sAE)) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
// richiamo gestione evento ausiliario dopo fine percorso di lavoro
|
||||
if ( ! OnPathEndAux( i, sAE)) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::ManageMove( int& nStatus)
|
||||
@@ -868,6 +926,40 @@ Simulator::OnPathEnd( void)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnPathStartAux( int nInd, const string& sAS)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_START_AUX))
|
||||
return true ;
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXIND, nInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUX, sAS) ;
|
||||
// chiamo la funzione di evento ausiliario all'inizio del percorso
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_START_AUX) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnPathEndAux( int nInd, const string& sAE)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_END_AUX))
|
||||
return true ;
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXIND, nInd) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUX, sAE) ;
|
||||
// chiamo la funzione di evento ausiliario alla fine del percorso
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_END_AUX) ;
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnMoveStart( const CamData* pCamData)
|
||||
|
||||
@@ -48,6 +48,8 @@ class Simulator
|
||||
bool ManageOperationEnd( int& nStatus) ;
|
||||
bool FindAndManagePathStart( int& nStatus) ;
|
||||
bool ManagePathEnd( int& nStatus) ;
|
||||
bool ManagePathStartAuxes( int& nStatus) ;
|
||||
bool ManagePathEndAuxes( int& nStatus) ;
|
||||
bool ManageMove( int& nStatus) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ;
|
||||
@@ -58,6 +60,8 @@ class Simulator
|
||||
bool OnToolDeselect( const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
|
||||
bool OnMachiningStart( int nOpId, int nOpInd) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr,
|
||||
const Point3d& ptMin, const Point3d& ptMax) ;
|
||||
bool OnPathEnd( void) ;
|
||||
|
||||
Reference in New Issue
Block a user