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