EgtMachKernel :

- razionalizzazione della interfaccia di simulazione
- correzione all'assegnamento di variabili lua durante la simulazione.
This commit is contained in:
Dario Sassi
2018-08-17 07:38:37 +00:00
parent fadc439156
commit bd74a8c9e7
6 changed files with 63 additions and 48 deletions
+36 -31
View File
@@ -70,7 +70,10 @@ Simulator::Simulator( void)
//----------------------------------------------------------------------------
Simulator::~Simulator( void)
{
Stop() ;
// porto la macchina in posizione home
GoHome() ;
// rimuovo tavola variabili globali
m_pMachine->LuaResetGlobVar( GLOB_VAR) ;
}
//----------------------------------------------------------------------------
@@ -104,8 +107,9 @@ Simulator::Start( bool bFirst)
if ( bFirst && ! VerifySetup())
bOk = false ;
// Reset utensile e assi correnti
// Reset utensile, interpolazione e assi correnti
m_sTool.clear() ;
ResetInterpolation() ;
ResetAxes() ;
ResetAuxAxes() ;
// porto la macchina in home
@@ -155,6 +159,28 @@ Simulator::VerifySetup( void)
return false ;
}
//----------------------------------------------------------------------------
bool
Simulator::ResetInterpolation( void)
{
m_nOpId = GDB_ID_NULL ;
m_nOpInd = 0 ;
m_nCLPathId = GDB_ID_NULL ;
m_nCLPathInd = 0 ;
m_nEntId = GDB_ID_NULL ;
m_nEntInd = 0 ;
m_dCoeff = 0 ;
m_nAuxSTot = 0 ;
m_nAuxSInd = 0 ;
m_nAuxETot = 0 ;
m_nAuxEInd = 0 ;
m_nVmId = GDB_ID_NULL ;
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_bEnabAxes = true ;
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::Move( int& nStatus)
@@ -334,8 +360,8 @@ bool
Simulator::SetStep( double dStep)
{
m_dStep = Clamp( dStep, MIN_STEP, MAX_STEP) ;
// imposto step per movimenti gestiti nelle macro di simulazione
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMSTEP, m_dStep) ;
// imposto step per movimenti gestiti nelle macro di simulazione ( con ripristino macchina Lua originale)
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMSTEP, m_dStep, true) ;
return true ;
}
@@ -344,8 +370,8 @@ bool
Simulator::SetUiStatus( int nUiStatus)
{
m_nUiStatus = nUiStatus ;
// imposto stato simulatore a livello utente per movimenti gestiti nelle macro di simulazione
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMUISTAT, m_nUiStatus) ;
// imposto stato utente del simulatore per movimenti gestiti nelle macro di simulazione ( con ripristino macchina Lua originale)
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMUISTAT, m_nUiStatus, true) ;
return true ;
}
@@ -364,27 +390,6 @@ Simulator::GoHome( void)
return m_pMchMgr->GetAllCurrAxesHomePos( m_AxesVal) ;
}
//----------------------------------------------------------------------------
bool
Simulator::Stop( void)
{
// porto in home
if ( ! GoHome())
return false ;
// rimuovo tavola variabili globali
m_pMachine->LuaResetGlobVar( GLOB_VAR) ;
// reset dello stato
m_nOpId = GDB_ID_NULL ;
m_nCLPathId = GDB_ID_NULL ;
m_nEntId = GDB_ID_NULL ;
m_dCoeff = 0 ;
m_nAuxSTot = 0 ;
m_nAuxSInd = 0 ;
m_nAuxETot = 0 ;
m_nAuxEInd = 0 ;
return true ;
}
//----------------------------------------------------------------------------
bool
Simulator::UpdateTool( bool bFirst)
@@ -971,7 +976,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
if ( m_nVmId != GDB_ID_NULL) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ; Frame3d frVzmF ;
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ; ;
ExecVmillOnLine( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
ExecLineVmill( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
}
}
// Eseguo movimento su arco
@@ -1007,7 +1012,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
if ( m_nVmId != GDB_ID_NULL) {
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ; Frame3d frVzmF ;
bool bOkF = GetHeadCurrPosDirAux( ptNoseF, vtDirF, vtAuxF) && m_pGeomDB->GetGlobFrame( m_nVmId, frVzmF) ;
ExecVmillOnLine( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
ExecLineVmill( ptNoseI, vtDirI, vtAuxI, frVzmI, ptNoseF, vtDirF, vtAuxF, frVzmF) ;
// aggiorno prossimo inizio
ptNoseI = ptNoseF ;
vtDirI = vtDirF ;
@@ -1091,8 +1096,8 @@ Simulator::GetHeadCurrPosDirAux( Point3d& ptH, Vector3d& vtH, Vector3d& vtA)
//----------------------------------------------------------------------------
bool
Simulator::ExecVmillOnLine( const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF)
Simulator::ExecLineVmill( const Point3d& ptHi, const Vector3d& vtHi, const Vector3d& vtAi, const Frame3d& frVzmI,
const Point3d& ptHf, const Vector3d& vtHf, const Vector3d& vtAf, const Frame3d& frVzmF)
{
// Recupero Zmap
IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( m_nVmId)) ;