EgtMachKernel :
- aggiunta gestione attrezzaggio anche in simulazione - in ToolDeselect aggiunto nome prossimo utensile EMT.NEXTTOOL.
This commit is contained in:
+23
-10
@@ -77,6 +77,10 @@ Simulator::Start( void)
|
||||
if ( m_pMchMgr == nullptr || m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
|
||||
return false ;
|
||||
|
||||
// recupero eventuale attrezzaggio della macchinata
|
||||
m_stuMgr.Init( m_pMchMgr) ;
|
||||
m_stuMgr.Load() ;
|
||||
|
||||
// Reset utensile e assi correnti
|
||||
m_sTool.clear() ;
|
||||
ResetAxes() ;
|
||||
@@ -301,15 +305,20 @@ Simulator::UpdateTool( bool bForced)
|
||||
if ( ! pMch->GetParam( MPA_TUUID, sTuuid) ||
|
||||
! m_pMchMgr->TdbGetToolFromUUID( sTuuid, sTool))
|
||||
return false ;
|
||||
if ( ! m_pMchMgr->TdbSetCurrTool( sTool))
|
||||
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) ;
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( ! m_stuMgr.GetToolData( sTool, sTcPos, sHead, nExit)) {
|
||||
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, sTcPos) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sHead) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
|
||||
}
|
||||
// ripristino l'utensile corrente
|
||||
m_pMchMgr->TdbSetCurrTool( m_sTool) ;
|
||||
}
|
||||
// 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, sTcPos))
|
||||
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos))
|
||||
return false ;
|
||||
}
|
||||
// se cambiato oppure forzato, attivo l'utensile della lavorazione
|
||||
@@ -317,7 +326,7 @@ Simulator::UpdateTool( bool bForced)
|
||||
// se forzato, pulisco la testa
|
||||
if ( bForced)
|
||||
m_pMchMgr->ResetHeadSet( sHead) ;
|
||||
// carico l'utensile
|
||||
// carico l'utensile (e lo rendo corrente)
|
||||
if ( ! m_pMchMgr->SetCalcTool( sTool, sHead, nExit))
|
||||
return false ;
|
||||
m_sTool = sTool ;
|
||||
@@ -337,7 +346,7 @@ Simulator::UpdateTool( bool bForced)
|
||||
string sTool ; string sHead ; int nExit ; string sTcPos ;
|
||||
pDisp->GetToolData( sTool, sHead, nExit, sTcPos) ;
|
||||
// eventuale lancio script per scarico utensile
|
||||
if ( ! OnToolDeselect( sHead, nExit, sTcPos))
|
||||
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos))
|
||||
return false ;
|
||||
// carico l'utensile
|
||||
if ( ! m_pMchMgr->SetCalcTool( sTool, sHead, nExit))
|
||||
@@ -449,6 +458,8 @@ Simulator::FindAndManageOperationStart( bool bFirst, int& nStatus)
|
||||
return false ;
|
||||
}
|
||||
++ m_nOpInd ;
|
||||
// imposto la lavorazione come corrente
|
||||
m_pMchMgr->SetCurrMachining( m_nOpId) ;
|
||||
// richiamo gestione evento inizio lavorazione
|
||||
if ( ! OnMachiningStart( m_nOpId, m_nOpInd)) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
@@ -882,10 +893,12 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnToolDeselect( const string& sNextHead, int nNextExit, const string& sNextTcPos)
|
||||
Simulator::OnToolDeselect( const std::string& sNextTool, const string& sNextHead, int nNextExit, const string& sNextTcPos)
|
||||
{
|
||||
// assegno il prossimo utensile
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTTOOL, sNextTool) ;
|
||||
// assegno la prossima testa
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_NEXTHEAD, sNextHead) ;
|
||||
bOk = 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
|
||||
|
||||
Reference in New Issue
Block a user