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
+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 ;