EgtMachKernel 1.6k7 :
- aggiunta prima versione del postprocessore - corretto salvataggio angolo rotazione per fixture - aggiunta GetParam di lavorazioni applicate - migliorata gestione DB lavorazioni con versioni e size nel file - corretto Clone di SawingData.
This commit is contained in:
@@ -54,6 +54,8 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtTable", Machine::LuaEmtTable) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAxis", Machine::LuaEmtAxis) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtHead", Machine::LuaEmtHead) ;
|
||||
// registro le funzioni di scrittura part program per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtWrite", Machine::LuaEmtWrite) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -70,6 +72,60 @@ Machine::LuaExit( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LuaCallFunction( const string& sFun)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
m_pMchLua = this ;
|
||||
// eseguo la funzione
|
||||
bool bOk = m_LuaMgr.CallFunction( sFun, 0) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LuaCreateGlobTable( const string& sName)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
m_pMchLua = this ;
|
||||
// eseguo la funzione
|
||||
bool bOk = ::LuaCreateGlobTable( m_LuaMgr.GetLuaState(), sName) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LuaResetGlobVar( const string& sName)
|
||||
{
|
||||
// imposto contesto corretto
|
||||
int nOldCtx = ExeGetCurrentContext() ;
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( m_pMchMgr->GetContextId()) ;
|
||||
// imposto l'oggetto corrente per Lua
|
||||
m_pMchLua = this ;
|
||||
// eseguo la funzione
|
||||
bool bOk = ::LuaResetGlobVar( m_LuaMgr.GetLuaState(), sName) ;
|
||||
// ripristino contesto originale
|
||||
if ( nOldCtx != m_pMchMgr->GetContextId())
|
||||
ExeSetCurrentContext( nOldCtx) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LuaLoadMachine( const string& sFile)
|
||||
@@ -104,10 +160,15 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
// lettura eventuale campo 'Offset' dalla tabella (default 0,0,0)
|
||||
Vector3d vtOffset ;
|
||||
LuaGetTabFieldParam( L, 1, "Offset", vtOffset) ;
|
||||
// lettura eventuale campo 'Processor' dalla tabella
|
||||
string sProcessor ;
|
||||
LuaGetTabFieldParam( L, 1, "Processor", sProcessor) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
string sOut = "LuaEmtGeneral : " + sFile ;
|
||||
if ( ! sProcessor.empty())
|
||||
sOut += ", " + sProcessor ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// verifico ci sia una macchina attiva
|
||||
@@ -118,6 +179,17 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
if ( ! m_pMchLua->LoadMachineGeometry( sFile, vtOffset))
|
||||
return luaL_error( L, " Load Machine failed") ;
|
||||
|
||||
// carico il processore della macchina
|
||||
if ( ! sProcessor.empty()) {
|
||||
// carico il file lua del processore
|
||||
string sProcPath = m_pMchLua->m_sMachineDir + "\\" + sProcessor ;
|
||||
if ( ! m_pMchLua->m_LuaMgr.ExecFile( sProcPath))
|
||||
return luaL_error( L, " Load Processor failed") ;
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), " Processor file not specified")
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
@@ -364,3 +436,18 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtWrite( lua_State* L)
|
||||
{
|
||||
// 1 parametro : string
|
||||
string sOut ;
|
||||
LuaCheckParam( L, 1, sOut)
|
||||
LuaClearStack( L) ;
|
||||
// emetto stringa
|
||||
bool bOk = m_pMchLua->WriterEmit( sOut) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
Reference in New Issue
Block a user