EgtMachKernel :

- modifiche a Simulazione e Generazione per dati ausiliari iniziali e finali di percorso.
This commit is contained in:
Dario Sassi
2017-01-05 18:47:38 +00:00
parent c1b66b4477
commit 476aaecdf6
5 changed files with 107 additions and 27 deletions
+25 -15
View File
@@ -555,8 +555,11 @@ Simulator::FindAndManagePathStart( int& nStatus)
Point3d ptMin, ptMax ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMIN, ptMin) ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_PMAX, ptMax) ;
// recupero il numero di eventi ausiliari
int nAS = 0 ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, nAS) ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, ptStart, vtExtr, ptMin, ptMax)) {
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, nAS, ptStart, vtExtr, ptMin, ptMax)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
@@ -572,14 +575,17 @@ Simulator::FindAndManagePathStart( int& nStatus)
bool
Simulator::ManagePathEnd( int& nStatus)
{
// gestione eventuali eventi ausiliari dopo percorso
if ( ! ManagePathEndAuxes( nStatus))
return false ;
// recupero il numero di eventi ausiliari
int nAE ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE_TOT, nAE) ;
// richiamo gestione evento fine percorso di lavoro
if ( ! OnPathEnd()) {
if ( ! OnPathEnd( nAE)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
// gestione eventuali eventi ausiliari dopo percorso
if ( ! ManagePathEndAuxes( nStatus))
return false ;
return true ;
}
@@ -589,13 +595,13 @@ Simulator::ManagePathStartAuxes( int& nStatus)
{
// recupero il numero di eventi ausiliari
int nAS ;
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AS#", nAS) || nAS == 0)
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, 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)) {
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS + ToString( i), sAS)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
@@ -615,13 +621,13 @@ Simulator::ManagePathEndAuxes( int& nStatus)
{
// recupero il numero di eventi ausiliari
int nAE ;
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, "AE#", nAE) || nAE == 0)
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE_TOT, 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)) {
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE + ToString( i), sAE)) {
nStatus = MCH_SIM_ERR ;
return false ;
}
@@ -890,12 +896,14 @@ Simulator::OnMachiningEnd( void)
//----------------------------------------------------------------------------
bool
Simulator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr,
const Point3d& ptMin, const Point3d& ptMax)
Simulator::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
// assegno numero di dati ausiliari iniziali
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAS) ;
// assegno punto iniziale e versore estrusione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_START, ptStart) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXTR, vtExtr) ;
@@ -914,13 +922,15 @@ Simulator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, c
//----------------------------------------------------------------------------
bool
Simulator::OnPathEnd( void)
Simulator::OnPathEnd( int nAE)
{
// assegno numero di dati ausiliari finali
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAE) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_END))
return true ;
return bOk ;
// chiamo la funzione di fine percorso di lavorazione
bool bOk = m_pMachine->LuaCallFunction( ON_SIMUL_PATH_END) ;
bOk = bOk && m_pMachine->LuaCallFunction( ON_SIMUL_PATH_END) ;
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
UpdateAxesPos() ;
return bOk ;
@@ -933,7 +943,7 @@ 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
// assegno indice e valore dato ausiliario
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