EgtMachKernel 1.6v9 :

- modifiche per emettere anche TCPOS in generazione e simulazione.
This commit is contained in:
Dario Sassi
2016-10-26 16:02:40 +00:00
parent d4e4ea3871
commit dbe150bb77
8 changed files with 43 additions and 28 deletions
+9 -4
View File
@@ -995,6 +995,7 @@ Disposition::SpecialApply( bool bRecalc)
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok)
static const string EVAR_HEAD = ".HEAD" ; // OUT (string) nome della testa
static const string EVAR_EXIT = ".EXIT" ; // OUT (int) indice dell'uscita
static const string EVAR_TCPOS = ".TCPOS" ; // OUT (string) nome della posizione nel TC
static const string EVAR_SHIFTS = ".SHIFTS" ; // OUT (int) numero di movimenti eseguiti
static const string EVAR_SBH = ".SBH" ; // OUT (bool) flag presenza operazioni manuali
static const string ON_SPECIAL_APPLY = "OnSpecialApplyDisposition" ;
@@ -1009,12 +1010,16 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DISPID, m_nOwnerId) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_APPLY) ;
// recupero valori parametri
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_HEAD, m_sHead) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_EXIT, m_nExit) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SHIFTS, m_nShifts) ;
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_SBH, m_bSomeByHand) ;
// recupero valori parametri opzionali
if ( ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_TCPOS, m_sTcPos))
m_sTcPos.clear() ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( nErr != 0) {
@@ -1038,11 +1043,12 @@ Disposition::SpecialApply( bool bRecalc)
//----------------------------------------------------------------------------
bool
Disposition::GetToolData( string& sName, string& sHead, int& nExit) const
Disposition::GetToolData( string& sName, string& sHead, int& nExit, string& sTcPos) const
{
sName = "" ;
sHead = m_sHead ;
nExit = m_nExit ;
sTcPos = m_sTcPos ;
return true ;
}
@@ -1072,8 +1078,7 @@ Disposition::GetExitNbr( void) const
const string&
Disposition::GetToolTcPos( void) const
{
static string sDummy = "" ;
return sDummy ;
return m_sTcPos ;
}
//----------------------------------------------------------------------------
+2 -1
View File
@@ -102,7 +102,7 @@ class Disposition : public Operation
double& dAngDeg, double& dMov) const ;
bool GetMoveRawData( int nInd, int& nRawId, int& nType, Point3d& ptPos, int& nFlag) const ;
bool SpecialApply( bool bRecalc) ;
bool GetToolData( string& sName, string& sHead, int& nExit) const ;
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
bool GetSomeByHand( void) const
{ return m_bSomeByHand ; }
@@ -115,6 +115,7 @@ class Disposition : public Operation
MVRDATAVECTOR m_vMvrData ; // elenco movimenti grezzi
std::string m_sHead ; // eventuale testa usata per muovere i pezzi
int m_nExit ; // eventuale uscita sulla testa
std::string m_sTcPos ; // eventuale posizione nel cambiautensili
int m_nShifts ; // numero eventuali spostamenti con testa
bool m_bSomeByHand ; // presenza di operazioni manuali (anche in aggiunta ad automatiche)
} ;
BIN
View File
Binary file not shown.
+15 -10
View File
@@ -210,13 +210,13 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
if ( ! pDisp->IsEmpty()) {
// Recupero l'utensile della disposizione corrente
string sTool ; string sHead ; int nExit ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit))
string sTool ; string sHead ; int nExit ; string sTcPos ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
return false ;
// Se utensile cambierà
if ( ! m_sTool.empty() && m_sTool != sTool) {
// emetto deselezione vecchio utensile
if ( ! OnToolDeselect( sHead, nExit))
if ( ! OnToolDeselect( sHead, nExit, sTcPos))
return false ;
}
// Aggiorno utensile e assi macchina
@@ -224,7 +224,7 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
return false ;
// Se utensile cambiato, emetto selezione nuovo utensile
if ( m_sTool != m_sPrevTool) {
if ( ! OnToolSelect( sTool, sHead, nExit))
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
return false ;
}
// Ciclo su tutti i percorsi CL della disposizione
@@ -268,15 +268,16 @@ Generator::ProcessMachining( int nOpId, int nOpInd)
// Se utensile cambierà
if ( ! m_sTool.empty() && m_sTool != sTool) {
// recupero la testa del prossimo utensile
string sNextHead ; int nNextExit ;
string sNextHead ; int nNextExit ; string sNextTcPos ;
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sNextHead) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nNextExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sNextTcPos) ;
}
// ripristino l'utensile corrente
m_pMchMgr->TdbSetCurrTool( m_sTool) ;
// emetto deselezione vecchio utensile
if ( ! OnToolDeselect( sNextHead, nNextExit))
if ( ! OnToolDeselect( sNextHead, nNextExit, sNextTcPos))
return false ;
}
// Aggiorno utensile e assi macchina
@@ -286,7 +287,8 @@ Generator::ProcessMachining( int nOpId, int nOpInd)
if ( m_sTool != m_sPrevTool) {
string sHead ; m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sHead) ;
int nExit ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
if ( ! OnToolSelect( sTool, sHead, nExit))
string sTcPos ; m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
if ( ! OnToolSelect( sTool, sHead, nExit, sTcPos))
return false ;
}
@@ -654,12 +656,13 @@ Generator::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d&
//----------------------------------------------------------------------------
bool
Generator::OnToolSelect( const string& sTool, const string& sHead, int nExit)
Generator::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
{
// assegno il nome dell'utensile, la testa e l'uscita
// assegno il nome dell'utensile, la testa, l'uscita e l'eventuale posizione nel toolchanger
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
// assegno il token e il nome degli assi
int nNumAxes = int( m_AxesName.size()) ;
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
@@ -679,12 +682,14 @@ Generator::OnToolSelect( const string& sTool, const string& sHead, int nExit)
//----------------------------------------------------------------------------
bool
Generator::OnToolDeselect( const string& sNextHead, int nNextExit)
Generator::OnToolDeselect( const string& sNextHead, int nNextExit, const string& sNextTcPos)
{
// assegno la prossima testa
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTHEAD, sNextHead) ;
// assegno la prossima uscita
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTEXIT, nNextExit) ;
// assegno l'eventuale prossima posizione nel TC
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTTCPOS, sNextTcPos) ;
// chiamo la funzione di deselezione utensile
bOk = bOk && m_pMachine->LuaCallFunction( ON_TOOL_DESELECT) ;
return bOk ;
+2 -2
View File
@@ -41,8 +41,8 @@ class Generator
bool OnProgramStart( const std::string& sMachName, const std::string& sCncFile, const std::string& sInfo) ;
bool OnProgramEnd( void) ;
bool ProcessToolData( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit) ;
bool OnToolDeselect( const std::string& sNextHead, int nNextExit) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos) ;
bool OnToolDeselect( const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase, bool bEmpty, bool bSomeByHand) ;
bool OnDispositionEnd( void) ;
bool OnTableData( const std::string& sName, const Point3d& ptOri1) ;
+2 -1
View File
@@ -54,12 +54,13 @@ static const std::string GVAR_RAWFLAG = ".RAWFLAG" ; // (int) flag per m
static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome utensile
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) posizione utensile nel TC
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TLEN = ".TLEN" ; // (num) lunghezza utensile
static const std::string GVAR_NEXTHEAD = ".NEXTHEAD" ; // (string) nome testa del prossimo utensile
static const std::string GVAR_NEXTEXIT = ".NEXTEXIT" ; // (int) indice uscita su testa del prox utensile
static const std::string GVAR_NEXTTCPOS = ".NEXTTCPOS" ; // (string) eventuale posizione del prox utensile nel TC
static const std::string GVAR_MCHID = ".MCHID" ; // (int) identificativo lavorazione
static const std::string GVAR_MCHIND = ".MCHIND" ; // (int) indice lavorazione
static const std::string GVAR_PATHID = ".PATHID" ; // (int) identificativo percorso di lavorazione
+11 -8
View File
@@ -505,10 +505,11 @@ Simulator::UpdateTool( bool bForced)
return false ;
string sHead ; m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sHead) ;
int nExit ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
string sTcPos ; m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
// se cambierà e non forzato (inizio), scarico l'utensile corrente
if ( sTool != m_sTool && ! bForced) {
// eventuale lancio script per scarico utensile
if ( ! OnToolDeselect( sHead, nExit))
if ( ! OnToolDeselect( sHead, nExit, sTcPos))
return false ;
}
// se cambiato oppure forzato, attivo l'utensile della lavorazione
@@ -524,7 +525,7 @@ Simulator::UpdateTool( bool bForced)
if ( ! UpdateAxes())
return false ;
// eventuale lancio script
if ( ! OnToolSelect( m_sTool, sHead, nExit))
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos))
return false ;
}
return true ;
@@ -533,10 +534,10 @@ Simulator::UpdateTool( bool bForced)
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( m_nOpId)) ;
if ( pDisp != nullptr) {
// recupero i dati
string sTool ; string sHead ; int nExit ;
pDisp->GetToolData( sTool, sHead, nExit) ;
string sTool ; string sHead ; int nExit ; string sTcPos ;
pDisp->GetToolData( sTool, sHead, nExit, sTcPos) ;
// eventuale lancio script per scarico utensile
if ( ! OnToolDeselect( sHead, nExit))
if ( ! OnToolDeselect( sHead, nExit, sTcPos))
return false ;
// carico l'utensile
if ( ! m_pMchMgr->SetCalcTool( sTool, sHead, nExit))
@@ -546,7 +547,7 @@ Simulator::UpdateTool( bool bForced)
if ( ! UpdateAxes())
return false ;
// eventuale lancio script
if ( ! OnToolSelect( m_sTool, sHead, nExit))
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos))
return false ;
return true ;
}
@@ -673,7 +674,7 @@ Simulator::OnDispositionEnd( void)
//----------------------------------------------------------------------------
bool
Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit)
Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, const string& sTcPos)
{
// assegno il nome dell'utensile, la testa e l'uscita
if ( ! m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, sTool) ||
@@ -703,12 +704,14 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit)
//----------------------------------------------------------------------------
bool
Simulator::OnToolDeselect( const string& sNextHead, int nNextExit)
Simulator::OnToolDeselect( const string& sNextHead, int nNextExit, const string& sNextTcPos)
{
// assegno la prossima testa
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTHEAD, sNextHead) ;
// assegno la prossima uscita
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTEXIT, nNextExit) ;
// assegno l'eventuale prossima posizione nel TC
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTTCPOS, sNextTcPos) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_TOOL_DESELECT))
return true ;
+2 -2
View File
@@ -48,8 +48,8 @@ class Simulator
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
const std::string& sTable, const Point3d& ptOri1, bool bEmpty) ;
bool OnDispositionEnd( void) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit) ;
bool OnToolDeselect( const std::string& sNextHead, int nNextExit) ;
bool OnToolSelect( const std::string& sTool, const std::string& sHead, int nExit, const std::string& sTcPos) ;
bool OnToolDeselect( const std::string& sNextHead, int nNextExit, const std::string& sNextTcPos) ;
bool OnMachiningStart( int nOpId, int nOpInd) ;
bool OnMachiningEnd( void) ;
bool OnPathStart( int nClPathId, int nClPathInd) ;