diff --git a/Simulator.cpp b/Simulator.cpp index bfefbdb..7a0722d 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -83,7 +83,7 @@ Simulator::Start( void) m_nOpId = nOpId ; // aggiornamenti legati al cambio di lavorazione (utensile e assi conseguenti) - if ( ! UpdateTool() || ! UpdateAxes()) + if ( ! UpdateTool( true) || ! UpdateAxes()) return false ; // porto la macchina in home @@ -284,7 +284,7 @@ Simulator::Stop( void) //---------------------------------------------------------------------------- bool -Simulator::UpdateTool( void) +Simulator::UpdateTool( bool bForced) { // Recupero l'utensile della lavorazione corrente string sTool ; @@ -293,10 +293,14 @@ Simulator::UpdateTool( void) return false ; if ( ! m_pMchMgr->TdbSetCurrTool( sTool)) return false ; - // se cambiato, attivo l'utensile della lavorazione - if ( sTool != m_sTool) { + // se cambiato oppure forzato, attivo l'utensile della lavorazione + if ( sTool != m_sTool || bForced) { string sHead ; m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sHead) ; int nExit ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ; + // se forzato, pulisco la testa + if ( bForced) + m_pMchMgr->ResetHeadSet( sHead) ; + // carico l'utensile if ( ! m_pMchMgr->SetCalcTool( sTool, sHead, nExit)) return false ; m_sTool = sTool ; diff --git a/Simulator.h b/Simulator.h index 4e98804..dd74532 100644 --- a/Simulator.h +++ b/Simulator.h @@ -35,7 +35,7 @@ class Simulator bool Stop( void) ; private : - bool UpdateTool( void) ; + bool UpdateTool( bool bForced = false) ; bool UpdateAxes( void) ; bool GoHome( void) ;