EgtMachKernel :
- modifiche a Simulazione e Generazione per dati ausiliari iniziali e finali di percorso.
This commit is contained in:
+71
-6
@@ -338,10 +338,25 @@ Generator::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
Point3d ptMin, ptMax ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_PMIN, ptMin) ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_PMAX, ptMax) ;
|
||||
// Recupero il numero di eventi ausiliari iniziali
|
||||
int nAS = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
|
||||
// Emetto inizio percorso di lavoro
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, ptStart, vtExtr, ptMin, ptMax))
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, vtExtr, ptMin, ptMax))
|
||||
return false ;
|
||||
|
||||
// Emissione eventuali dati ausiliari di inizio
|
||||
// processo gli eventi
|
||||
for ( int i = 1 ; i <= nAS ; ++ i) {
|
||||
// recupero i dati per l'evento
|
||||
string sAS ;
|
||||
if ( ! m_pGeomDB->GetInfo( nClPathId, KEY_AS + ToString( i), sAS))
|
||||
return false ;
|
||||
// richiamo gestione evento ausiliario prima di inizio percorso di lavoro
|
||||
if ( ! OnPathStartAux( i, sAS))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Ciclo su tutte le entità del percorso CL
|
||||
bool bOk = true ;
|
||||
int nEntInd = 0 ;
|
||||
@@ -355,8 +370,24 @@ Generator::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
|
||||
// Recupero il numero di eventi ausiliari finali
|
||||
int nAE = 0 ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_AE_TOT, nAE) ;
|
||||
|
||||
// Emetto fine percorso di lavoro
|
||||
bOk = bOk && OnPathEnd() ;
|
||||
bOk = bOk && OnPathEnd( nAE) ;
|
||||
|
||||
// Emissione eventuali dati ausiliari di fine
|
||||
// processo gli eventi
|
||||
for ( int i = 1 ; i <= nAE ; ++ i) {
|
||||
// recupero i dati per l'evento
|
||||
string sAE ;
|
||||
if ( ! m_pGeomDB->GetInfo( nClPathId, KEY_AE + ToString( i), sAE))
|
||||
return false ;
|
||||
// richiamo gestione evento ausiliario dopo fine percorso di lavoro
|
||||
if ( ! OnPathEndAux( i, sAE))
|
||||
return false ;
|
||||
}
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
@@ -731,12 +762,14 @@ Generator::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr,
|
||||
const Point3d& ptMin, const Point3d& ptMax)
|
||||
Generator::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) ;
|
||||
@@ -750,10 +783,42 @@ Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, c
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnPathEnd( void)
|
||||
Generator::OnPathEnd( int nAE)
|
||||
{
|
||||
// assegno numero di dati ausiliari finali
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AUXTOT, nAE) ;
|
||||
// chiamo la funzione di fine percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaCallFunction( ON_PATH_END) ;
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_PATH_END) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnPathStartAux( int nInd, const string& sAS)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_PATH_START_AUX))
|
||||
return true ;
|
||||
// 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 emissione dato ausiliario ad inizio percorso di lavorazione
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_PATH_START_AUX) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnPathEndAux( int nInd, const string& sAE)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_PATH_END_AUX))
|
||||
return true ;
|
||||
// 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, sAE) ;
|
||||
// chiamo la funzione di emissione dato ausiliario alla fine percorso di lavorazione
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_PATH_END_AUX) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -51,9 +51,11 @@ class Generator
|
||||
bool OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d& ptPos, int nFlag) ;
|
||||
bool OnMachiningStart( int nOpId, int nOpInd, double dSpeed) ;
|
||||
bool OnMachiningEnd( void) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr,
|
||||
const Point3d& ptMin, const Point3d& ptMax) ;
|
||||
bool OnPathEnd( void) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnPathStartAux( int nInd, const std::string& sAS) ;
|
||||
bool OnPathEndAux( int nInd, const std::string& sAE) ;
|
||||
bool OnRapid( int nMove, const DBLVECTOR& AxesEnd, int nAxesMask, int nFlag) ;
|
||||
bool OnLinear( int nMove, const DBLVECTOR& AxesEnd, double dFeed, int nFlag) ;
|
||||
bool OnArc( int nMove, const DBLVECTOR& AxesEnd, const Point3d& ptCen, double dRad, double dAngCen,
|
||||
|
||||
@@ -70,6 +70,7 @@ 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_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine 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
|
||||
@@ -136,6 +137,8 @@ static const std::string ON_MACHINING_START = "OnMachiningStart" ;
|
||||
static const std::string ON_MACHINING_END = "OnMachiningEnd" ;
|
||||
static const std::string ON_PATH_START = "OnPathStart" ;
|
||||
static const std::string ON_PATH_END = "OnPathEnd" ;
|
||||
static const std::string ON_PATH_START_AUX = "OnPathStartAux" ;
|
||||
static const std::string ON_PATH_END_AUX = "OnPathEndAux" ;
|
||||
static const std::string ON_RAPID = "OnRapid" ;
|
||||
static const std::string ON_LINEAR = "OnLinear" ;
|
||||
static const std::string ON_ARC = "OnArc" ;
|
||||
|
||||
+25
-15
@@ -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
|
||||
|
||||
+3
-3
@@ -62,9 +62,9 @@ class Simulator
|
||||
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) ;
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnMoveStart( const CamData* pCamData) ;
|
||||
bool OnMoveEnd( void) ;
|
||||
bool OnResetMachine( void) ;
|
||||
|
||||
Reference in New Issue
Block a user