EgtMachKernel 1.6r9 :
- separato nome da token per gli assi macchina e gestito il tutto - in milling aggiunta gestione punto start e estrusione di path per piano locale di interpolazione in part-program - migliorata gestione deselezione utensile in simulazione.
This commit is contained in:
+49
-17
@@ -22,6 +22,7 @@
|
||||
#include "OutputConst.h"
|
||||
#include "/EgtDev/Include/EMkToolConst.h"
|
||||
#include "/EgtDev/Include/EMkOperationConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
|
||||
@@ -37,6 +38,7 @@ Generator::Generator( void)
|
||||
m_pGeomDB = nullptr ;
|
||||
m_pMachine = nullptr ;
|
||||
m_AxesName.reserve( 8) ;
|
||||
m_AxesToken.reserve( 8) ;
|
||||
m_AxesVal.reserve( 8) ;
|
||||
}
|
||||
|
||||
@@ -206,7 +208,7 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
|
||||
// Se utensile cambierà
|
||||
if ( ! m_sTool.empty() && m_sTool != sTool) {
|
||||
// emetto deselezione vecchio utensile
|
||||
if ( ! OnToolDeselect())
|
||||
if ( ! OnToolDeselect( sHead, nExit))
|
||||
return false ;
|
||||
}
|
||||
// Aggiorno utensile e assi macchina
|
||||
@@ -214,7 +216,7 @@ Generator::ProcessDisposition( int nOpId, int nOpInd)
|
||||
return false ;
|
||||
// Se utensile cambiato, emetto selezione nuovo utensile
|
||||
if ( m_sTool != m_sPrevTool) {
|
||||
if ( ! OnToolSelect())
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit))
|
||||
return false ;
|
||||
}
|
||||
// Ciclo su tutti i percorsi CL della disposizione
|
||||
@@ -256,8 +258,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 ;
|
||||
if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sNextHead) ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nNextExit) ;
|
||||
}
|
||||
// ripristino l'utensile corrente
|
||||
m_pMchMgr->TdbSetCurrTool( m_sTool) ;
|
||||
// emetto deselezione vecchio utensile
|
||||
if ( ! OnToolDeselect())
|
||||
if ( ! OnToolDeselect( sNextHead, nNextExit))
|
||||
return false ;
|
||||
}
|
||||
// Aggiorno utensile e assi macchina
|
||||
@@ -265,7 +275,9 @@ Generator::ProcessMachining( int nOpId, int nOpInd)
|
||||
return false ;
|
||||
// Se utensile cambiato, emetto selezione nuovo utensile
|
||||
if ( m_sTool != m_sPrevTool) {
|
||||
if ( ! OnToolSelect())
|
||||
string sHead ; m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, sHead) ;
|
||||
int nExit ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, nExit) ;
|
||||
if ( ! OnToolSelect( sTool, sHead, nExit))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -302,11 +314,17 @@ Generator::ProcessMachining( int nOpId, int nOpInd)
|
||||
bool
|
||||
Generator::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
|
||||
{
|
||||
// Recupero punto di inizio del percorso
|
||||
Point3d ptStart ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_START, ptStart) ;
|
||||
// Recupero versore estrusione associato al percorso (normale al piano di interpolazione)
|
||||
Vector3d vtExtr ;
|
||||
m_pGeomDB->GetInfo( nClPathId, KEY_EXTR, vtExtr) ;
|
||||
// Emetto inizio percorso di lavoro
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd))
|
||||
if ( ! OnPathStart( nClPathId, nClPathInd, ptStart, vtExtr))
|
||||
return false ;
|
||||
|
||||
// Ciclo su tutte le entità del percorsi CL
|
||||
// Ciclo su tutte le entità del percorso CL
|
||||
bool bOk = true ;
|
||||
int nEntInd = 0 ;
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
|
||||
@@ -398,7 +416,8 @@ bool
|
||||
Generator::UpdateAxes( void)
|
||||
{
|
||||
// Carico i nomi degli assi macchina attivi
|
||||
return m_pMachine->GetAllCurrAxesName( m_AxesName) ;
|
||||
return m_pMachine->GetAllCurrAxesName( m_AxesName) &&
|
||||
m_pMachine->GetAllCurrAxesToken( m_AxesToken) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -532,17 +551,23 @@ Generator::OnRawMoveData( int nRawId, int RawMoveInd, int nType, const Point3d&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnToolSelect( void)
|
||||
Generator::OnToolSelect( const string& sTool, const string& sHead, int nExit)
|
||||
{
|
||||
// assegno il nome dell'utensile
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TOOL, m_sTool) ;
|
||||
// assegno il nome degli assi
|
||||
// assegno il nome dell'utensile, la testa e l'uscita
|
||||
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) ;
|
||||
// assegno il token e il nome degli assi
|
||||
int nNumAxes = int( m_AxesName.size()) ;
|
||||
for ( int i = 1 ; i <= MAX_AXES ; ++ i) {
|
||||
if ( i <= nNumAxes)
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesName[i-1]) ;
|
||||
else
|
||||
if ( i <= nNumAxes) {
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisToken(i), m_AxesToken[i-1]) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GetGlobVarAxisName(i), m_AxesName[i-1]) ;
|
||||
}
|
||||
else {
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisToken(i)) ;
|
||||
bOk = bOk && m_pMachine->LuaResetGlobVar( GetGlobVarAxisName(i)) ;
|
||||
}
|
||||
}
|
||||
// chiamo la funzione di selezione utensile
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_TOOL_SELECT) ;
|
||||
@@ -551,10 +576,14 @@ Generator::OnToolSelect( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnToolDeselect( void)
|
||||
Generator::OnToolDeselect( const string& sNextHead, int nNextExit)
|
||||
{
|
||||
// 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) ;
|
||||
// chiamo la funzione di deselezione utensile
|
||||
bool bOk = m_pMachine->LuaCallFunction( ON_TOOL_DESELECT) ;
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_TOOL_DESELECT) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -583,11 +612,14 @@ Generator::OnMachiningEnd( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Generator::OnPathStart( int nClPathId, int nClPathInd)
|
||||
Generator::OnPathStart( int nClPathId, int nClPathInd, const Point3d& ptStart, const Vector3d& vtExtr)
|
||||
{
|
||||
// assegno identificativo e indice percorso di lavorazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHIND, nClPathInd) ;
|
||||
// assegno punto iniziale e versore estrusione
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_START, ptStart) ;
|
||||
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXTR, vtExtr) ;
|
||||
// chiamo la funzione di inizio percorso di lavorazione
|
||||
bOk = bOk && m_pMachine->LuaCallFunction( ON_PATH_START) ;
|
||||
return bOk ;
|
||||
|
||||
Reference in New Issue
Block a user