EgtMachKernel 1.6p4 :

- ampliata Disposizione con gestione movimenti di pezzi con la testa tramite SpecialApply (che richiama script)
- modifiche a Simulatore per gestire queste disposizioni e aggiunti richiami script su diversi eventi
- modifiche a Generatore per gestire queste disposizioni
- varie altre modifiche e migliorie.
This commit is contained in:
Dario Sassi
2016-05-05 07:31:35 +00:00
parent 06a8b15d99
commit b8965da858
37 changed files with 3234 additions and 1898 deletions
+62 -82
View File
@@ -19,6 +19,7 @@
#include "Disposition.h"
#include "Machining.h"
#include "MachiningConst.h"
#include "OutputConst.h"
#include "/EgtDev/Include/EMkToolConst.h"
#include "/EgtDev/Include/EMkOperationConst.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -29,84 +30,6 @@ using namespace std ;
//----------------------------------------------------------------------------
static const string ERR_EXT = ".err" ;
static const int MAX_AXES = 5 ;
static const string GLOB_VAR = "EMT" ; // tavola variabili globali
static const string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
static const string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
static const string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
static const string GVAR_NUMTOK = ".Nt" ; // (string) token per numerazione
static const string GVAR_LINENBR = ".LINENBR" ; // (int) numero progressivo di linea
static const string GVAR_LINEINC = ".LINEINC" ; // (int) incremento per numero di linea
static const string GVAR_F = ".F" ; // (num) valore della feed
static const string GVAR_FT = ".Ft" ; // (string) token per feed
static const string GVAR_S = ".S" ; // (num) valore della speed
static const string GVAR_ST = ".St" ; // (string) token per speed
static const string GVAR_FILE = ".FILE" ; // (string) path file di output
static const string GVAR_INFO = ".INFO" ; // (string) informazioni iniziali
static const string GVAR_DISPID = ".DISPID" ; // (int) identificativo disposizione
static const string GVAR_DISPIND = ".DISPIND" ; // (int) indice disposizione
static const string GVAR_PHASE = ".PHASE" ; // (int) indice fase
static const string GVAR_TABNAME = ".TABNAME" ; // (string) nome tavola
static const string GVAR_TABORI1 = ".TABORI1" ; // (Point3d) prima origine di tavola
static const string GVAR_FIXID = ".FIXID" ; // (int) identificativo bloccaggio (fixture)
static const string GVAR_FIXIND = ".FIXIND" ; // (int) indice bloccaggio
static const string GVAR_FIXNAME = ".FIXNAME" ; // (string) nome bloccaggio
static const string GVAR_FIXPOS = ".FIXPOS" ; // (Point3d) posizione bloccaggio
static const string GVAR_FIXANG = ".FIXANG" ; // (num) angolo di rotazione bloccaggio
static const string GVAR_RAWID = ".RAWID" ; // (int) identificativo grezzo
static const string GVAR_RAWIND = ".RAWIND" ; // (int) indice movimento del grezzo
static const string GVAR_RAWTYPE = ".RAWTYPE" ; // (int) tipo di movimento del grezzo
static const string GVAR_RAWPOS = ".RAWPOS" ; // (Point3d) posizione di movimento del grezzo
static const string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per movimento del grezzo
static const string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
static const string GVAR_PATHIND = ".PATHIND" ; // (int) indice percorso di lavorazione
static const string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
static const string GVAR_R1 = ".R1" ; // (num) valore del primo asse rotante
static const string GVAR_R2 = ".R2" ; // (num) valore del secondo asse rotante
static const string GVAR_C1 = ".C1" ; // (num) valore del primo asse lineare per centro arco
static const string GVAR_C2 = ".C2" ; // (num) valore del secondo asse lineare per centro arco
static const string GVAR_C3 = ".C3" ; // (num) valore del terzo asse lineare per centro arco
static const string GVAR_RR = ".RR" ; // (num) valore raggio per arco
static const string GVAR_AC = ".AC" ; // (num) valore angolo al centro per arco
static const string GVAR_L1P = ".L1p" ; // (num) valore precedente del primo asse lineare
static const string GVAR_L2P = ".L2p" ; // (num) valore precedente del secondo asse lineare
static const string GVAR_L3P = ".L3p" ; // (num) valore precedente del terzo asse lineare
static const string GVAR_R1P = ".R1p" ; // (num) valore precedente del primo asse rotante
static const string GVAR_R2P = ".R2p" ; // (num) valore precedente del secondo asse rotante
static const string GVAR_L1T = ".L1t" ; // (num) token del primo asse lineare
static const string GVAR_L2T = ".L2t" ; // (num) token del secondo asse lineare
static const string GVAR_L3T = ".L3t" ; // (num) token del terzo asse lineare
static const string GVAR_R1T = ".R1t" ; // (num) token del primo asse rotante
static const string GVAR_R2T = ".R2t" ; // (num) token del secondo asse rotante
static const string GVAR_C1T = ".C1t" ; // (num) token del primo asse lineare per centro arco
static const string GVAR_C2T = ".C2t" ; // (num) token del secondo asse lineare per centro arco
static const string GVAR_C3T = ".C3t" ; // (num) token del terzo asse lineare per centro arco
static const string GVAR_RRT = ".RRt" ; // (num) token del raggio per arco
static const string GVAR_MASK = ".MASK" ; // (int) mask associato ai movimenti in rapido
static const string GVAR_FLAG = ".FLAG" ; // (int) flag associato ad ogni movimento
static const string ON_START = "OnStart" ;
static const string ON_END = "OnEnd" ;
static const string ON_PROGRAM_START = "OnProgramStart" ;
static const string ON_PROGRAM_END = "OnProgramEnd" ;
static const string ON_TOOL_SELECT = "OnToolSelect" ;
static const string ON_TOOL_DESELECT = "OnToolDeselect" ;
static const string ON_DISPOSITION_START = "OnDispositionStart" ;
static const string ON_DISPOSITION_END = "OnDispositionEnd" ;
static const string ON_TABLE_DATA = "OnTableData" ;
static const string ON_FIXTURE_DATA = "OnFixtureData" ;
static const string ON_RAWMOVE_DATA = "OnRawMoveData" ;
static const string ON_MACHINING_START = "OnMachiningStart" ;
static const string ON_MACHINING_END = "OnMachiningEnd" ;
static const string ON_PATH_START = "OnPathStart" ;
static const string ON_PATH_END = "OnPathEnd" ;
static const string ON_RAPID = "OnRapid" ;
static const string ON_LINEAR = "OnLinear" ;
static const string ON_ARC = "OnArc" ;
//----------------------------------------------------------------------------
Generator::Generator( void)
@@ -161,7 +84,7 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
// evento inizio esecuzione
bool bOk = true ;
if ( bOk && ! OnStart()) {
if ( ! OnStart()) {
bOk = false ;
LOG_INFO( GetEMkLogger(), "OnStart error") ;
}
@@ -212,7 +135,7 @@ Generator::Run( const string& sCncFile, const std::string& sInfo)
RenameFile( sCncFile, sErrFile) ;
// evento fine esecuzione
if ( bOk && ! OnEnd()) {
if ( ! OnEnd()) {
bOk = false ;
LOG_INFO( GetEMkLogger(), "OnEnd error") ;
}
@@ -232,9 +155,10 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
// Imposto la fase
int nPhase = pDisp->GetPhase() ;
m_pMchMgr->SetCurrPhase( nPhase) ;
bool bEmpty = pDisp->IsEmpty() ;
// Emetto inizio disposizione
if ( ! OnDispositionStart( nOpId, nOpInd, nPhase))
if ( ! OnDispositionStart( nOpId, nOpInd, nPhase, bEmpty))
return false ;
// Emetto dati tavola
@@ -273,6 +197,42 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
break ;
}
// Se disposizione con movimenti macchina
if ( ! pDisp->IsEmpty()) {
// Recupero l'utensile della disposizione corrente
string sTool ; string sHead ; int nExit ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit))
return false ;
// Se utensile cambierà
if ( ! m_sTool.empty() && m_sTool != sTool) {
// emetto deselezione vecchio utensile
if ( ! OnToolDeselect())
return false ;
}
// Aggiorno utensile e assi macchina
if ( ! UpdateDispTool( sTool, sHead, nExit) || ! UpdateAxes())
return false ;
// Se utensile cambiato, emetto selezione nuovo utensile
if ( m_sTool != m_sPrevTool) {
if ( ! OnToolSelect())
return false ;
}
// Ciclo su tutti i percorsi CL della disposizione
bool bOk = true ;
int nClPathInd = 0 ;
int nClId = m_pGeomDB->GetFirstNameInGroup( nOpId, MCH_CL) ;
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( bOk && nClPathId != GDB_ID_NULL) {
++ nClPathInd ;
// processo il percorso di lavoro
if ( ! ProcessClPath( nClPathId, nClPathInd, nOpId, nOpInd))
bOk = false ;
// passo al percorso successivo
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
}
// Emetto fine disposizione
if ( ! OnDispositionEnd())
return false ;
@@ -420,6 +380,22 @@ Generator::UpdateTool( const string& sTool)
return true ;
}
//----------------------------------------------------------------------------
bool
Generator::UpdateDispTool( const string& sTool, const string& sHead, int nExit)
{
// Salvo l'utensile attuale come precedente
m_sPrevTool = m_sTool ;
// Se cambiato ...
if ( sTool != m_sTool) {
// lo carico in macchina
if ( ! m_pMchMgr->SetCalcTool( sTool, sHead, nExit))
return false ;
m_sTool = sTool ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Generator::UpdateAxes( void)
@@ -458,6 +434,8 @@ Generator::OnEnd( void)
{
// chiamo la funzione
bool bOk = m_pMachine->LuaCallFunction( ON_END) ;
// rimuovo tavola variabili globali
bOk = m_pMachine->LuaResetGlobVar( GLOB_VAR) && bOk ;
return bOk ;
}
@@ -490,13 +468,15 @@ Generator::OnProgramEnd( void)
//----------------------------------------------------------------------------
bool
Generator::OnDispositionStart( int nOpId, int nOpInd, int nPhase)
Generator::OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty)
{
// 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
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PHASE, nPhase) ;
// assegno flag disposizione passiva
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EMPTY, bEmpty) ;
// chiamo la funzione di inizio disposizione
bOk = bOk && m_pMachine->LuaCallFunction( ON_DISPOSITION_START) ;
return bOk ;