EgtMachKernel :
- in simulazione aggiunta possibilità di gestire extra-corse di assi ausiliari in OnMoveStart - aggiunta funzione lua EmtSetOutstrokeInfo.
This commit is contained in:
@@ -297,6 +297,7 @@ class Machine
|
||||
static int LuaEmtUnlinkPartFromGroup( lua_State* L) ;
|
||||
static int LuaEmtUnlinkAllPartsFromGroups( lua_State* L) ;
|
||||
static int LuaEmtWrite( lua_State* L) ;
|
||||
static int LuaEmtSetOutstrokeInfo( lua_State* L) ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-2
@@ -327,7 +327,7 @@ Machine::GetCurrHead( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrHead( std::string& sHead) const
|
||||
Machine::GetCurrHead( string& sHead) const
|
||||
{
|
||||
// controllo GeomDB
|
||||
if ( m_pGeomDB == nullptr)
|
||||
@@ -1352,7 +1352,7 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string
|
||||
string
|
||||
Machine::GetOutstrokeInfo( bool bMM) const
|
||||
{
|
||||
// se non c'è extracorsa, ritorno stringa vuota
|
||||
|
||||
@@ -106,6 +106,8 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtGetAxesPos", Machine::LuaEmtGetAxesPos) ;
|
||||
// registro le funzioni di scrittura part program per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtWrite", Machine::LuaEmtWrite) ;
|
||||
// registro la funzione per impostare informazioni di outstroke
|
||||
m_LuaMgr.RegisterFunction( "EmtSetOutstrokeInfo", Machine::LuaEmtSetOutstrokeInfo) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -935,3 +937,33 @@ Machine::LuaEmtWrite( lua_State* L)
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtSetOutstrokeInfo( lua_State* L)
|
||||
{
|
||||
// 5 parametri : sAxName, sAxToken, bLinear, dExtra, sAuxInfo
|
||||
string sAxName ;
|
||||
LuaCheckParam( L, 1, sAxName)
|
||||
string sAxToken ;
|
||||
LuaCheckParam( L, 2, sAxToken)
|
||||
bool bLinear ;
|
||||
LuaCheckParam( L, 3, bLinear)
|
||||
double dExtra ;
|
||||
LuaCheckParam( L, 4, dExtra)
|
||||
string sAuxInfo ;
|
||||
LuaCheckParam( L, 5, sAuxInfo)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
m_pMchLua->m_OutstrokeInfo.sAxName = sAxName ;
|
||||
m_pMchLua->m_OutstrokeInfo.sAxToken = sAxToken ;
|
||||
m_pMchLua->m_OutstrokeInfo.bLinear = bLinear ;
|
||||
m_pMchLua->m_OutstrokeInfo.dExtra = dExtra ;
|
||||
m_pMchLua->m_OutstrokeInfo.sAuxInfo = sAuxInfo ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, true) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
static const int MAX_AXES = 7 ;
|
||||
// Variabili
|
||||
static const std::string GLOB_VAR = "EMT" ; // tavola variabili globali
|
||||
static const std::string GVAR_ERR = ".ERR" ; // (int) codice di errore (0=ok)
|
||||
static const std::string GVAR_USETO1 = ".USETO1" ; // (bool) flag per utilizzo origine tavola
|
||||
static const std::string GVAR_MODAL = ".MODAL" ; // (bool) flag per emissione modale dei valori
|
||||
static const std::string GVAR_NUM = ".NUM" ; // (bool) flag numerazione
|
||||
|
||||
+14
-3
@@ -891,11 +891,15 @@ Simulator::ManageMove( int& nStatus)
|
||||
// Se inizio di nuova entità
|
||||
if ( m_nEntId != GDB_ID_NULL && m_dCoeff < EPS_ZERO) {
|
||||
++ m_nEntInd ;
|
||||
if ( ! OnMoveStart( pCamData)) {
|
||||
int nErr ;
|
||||
if ( ! OnMoveStart( pCamData, nErr)) {
|
||||
if ( Stopped())
|
||||
return true ;
|
||||
else {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
if ( nErr == 1)
|
||||
nStatus = MCH_SIM_OUTSTROKE ;
|
||||
else
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -1385,8 +1389,10 @@ Simulator::OnPathEndAux( int nInd, const string& sAE)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnMoveStart( const CamData* pCamData)
|
||||
Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
|
||||
{
|
||||
// reset stato di errore da script
|
||||
nErr = 0 ;
|
||||
// recupero e assegno i dati
|
||||
// dati generali
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, m_nEntId) ;
|
||||
@@ -1424,6 +1430,11 @@ Simulator::OnMoveStart( const CamData* pCamData)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// verifico codice di errore
|
||||
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||
if ( nErr != 0)
|
||||
return false ;
|
||||
|
||||
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
|
||||
UpdateAxesPos() ;
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ class Simulator
|
||||
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax, double dElev) ;
|
||||
bool OnPathEnd( int nAE) ;
|
||||
bool OnMoveStart( const CamData* pCamData) ;
|
||||
bool OnMoveStart( const CamData* pCamData, int& nErr) ;
|
||||
bool OnMoveEnd( void) ;
|
||||
bool OnResetMachine( void) ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user