EgtExecutor 1.6k6 :
- aggiunta funzione per gestione info e posizione assi in simulazione - aggiunta gestione callback per output testi.
This commit is contained in:
@@ -24,3 +24,6 @@ bool IsCmdLog( void) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int ProcessEvents( int nProg, int nPause) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool OutText( const std::string& sText) ;
|
||||
|
||||
@@ -40,6 +40,7 @@ static bool s_bCmdLog = false ;
|
||||
static Logger* s_pCmdLog = nullptr ;
|
||||
static string s_sKey ;
|
||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||
static pfOutText s_pFunOutText = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -335,6 +336,14 @@ ExeSetProcessEvents( pfProcEvents pFun)
|
||||
return ( pFun != nullptr) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetOutText( pfOutText pFun)
|
||||
{
|
||||
s_pFunOutText = pFun ;
|
||||
return ( pFun != nullptr) ;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -376,3 +385,13 @@ ProcessEvents( int nProg, int nPause)
|
||||
else
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
OutText( const string& sText)
|
||||
{
|
||||
if ( s_pFunOutText != nullptr)
|
||||
return s_pFunOutText( sText) ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1050,6 +1050,16 @@ ExeAddMachining( const string& sName, const std::string& sMachining)
|
||||
return pGseCtx->m_pMachMgr->AddMachining( sName, sMachining) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetCurrMachining( int nId)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// imposto la lavorazione di identificativo Id come corrnte
|
||||
return pGseCtx->m_pMachMgr->SetCurrMachining( nId) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMachiningParam( int nType, bool bVal)
|
||||
@@ -1142,6 +1152,16 @@ ExeSimHome( void)
|
||||
return pGseCtx->m_pMachMgr->ResetAllAxesPos() ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSimGetAxisInfoPos( int nI, std::string& sName, double& dVal)
|
||||
{
|
||||
GseContext* pGseCtx = GetCurrGseContext() ;
|
||||
VERIFY_CTX_MACHMGR( pGseCtx, false)
|
||||
// recupero stringa con quote degli assi attivi
|
||||
return pGseCtx->m_pMachMgr->SimGetAxisInfoPos( nI, sName, dVal) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSimSetStep( double dStep)
|
||||
|
||||
Binary file not shown.
@@ -217,6 +217,21 @@ LuaProcessEvents( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaOutText( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sText
|
||||
string sText ;
|
||||
LuaCheckParam( L, 1, sText)
|
||||
LuaClearStack( L) ;
|
||||
// lancio emissione testo
|
||||
bool bOk = OutText( sText) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopyFile( lua_State* L)
|
||||
@@ -377,6 +392,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutLog", LuaOutLog) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutBox", LuaOutBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProcessEvents", LuaProcessEvents) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtOutText", LuaOutText) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyFile", LuaCopyFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRenameFile", LuaRenameFile) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEraseFile", LuaEraseFile) ;
|
||||
|
||||
+44
-3
@@ -1119,7 +1119,7 @@ LuaGetNextOperation( lua_State* L)
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero la prima operazione della macchinata corrente
|
||||
// recupero la successiva operazione della macchinata corrente
|
||||
int nNextId = ExeGetNextOperation( nId) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
@@ -1137,7 +1137,7 @@ LuaGetOperationType( lua_State* L)
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero la prima operazione della macchinata corrente
|
||||
// restituisco il tipo dell'operazione indicata della macchinata corrente
|
||||
int nType = ExeGetOperationType( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, nType) ;
|
||||
@@ -1150,7 +1150,7 @@ LuaRemoveAllOperations( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// elimino tutte le operazioni della macchinata corrente
|
||||
// elimino tutte le operazioni della macchinata corrente tranne la prima disposizione
|
||||
bool bOk = ExeRemoveAllOperations() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
@@ -1179,6 +1179,21 @@ LuaAddMachining( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetCurrMachining( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// imposto la lavorazione come corrente
|
||||
bool bOk = ExeSetCurrMachining( nId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetMachiningParam( lua_State* L)
|
||||
@@ -1273,6 +1288,30 @@ LuaSimMove( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSimGetAxisInfoPos( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nInd
|
||||
int nInd ;
|
||||
LuaCheckParam( L, 1, nInd)
|
||||
LuaClearStack( L) ;
|
||||
// calcolo nome e posizione dell'asse
|
||||
string sName ;
|
||||
double dVal ;
|
||||
bool bOk = ExeSimGetAxisInfoPos( nInd, sName, dVal) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, sName) ;
|
||||
LuaSetParam( L, dVal) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSimHome( lua_State* L)
|
||||
@@ -1655,6 +1694,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveAllOperations", LuaRemoveAllOperations) ;
|
||||
// Machinings
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachining", LuaAddMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrMachining", LuaSetCurrMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningParam", LuaSetMachiningParam) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningGeometry", LuaSetMachiningGeometry) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApplyMachining", LuaApplyMachining) ;
|
||||
@@ -1662,6 +1702,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimMove", LuaSimMove) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimHome", LuaSimHome) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimGetAxisInfoPos", LuaSimGetAxisInfoPos) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetStep", LuaSimSetStep) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSimStop", LuaSimStop) ;
|
||||
// Generation
|
||||
|
||||
Reference in New Issue
Block a user