EgtMachKernel 2.5a2 :
- in simulazione corretta gestione collisione rilevata durante ToolDeselect che non deve far saltare le successive operazioni - aggiunta funzione lua EmtMoveAxes per consentire movimento assi in simulazione da esterno.
This commit is contained in:
@@ -136,6 +136,8 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
|
||||
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
|
||||
// registro la funzione di movimento assi in simulazione
|
||||
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1386,3 +1388,44 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
{
|
||||
// 4, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
|
||||
int nMoveType ;
|
||||
LuaCheckParam( L, 1, nMoveType)
|
||||
string sAx1 ;
|
||||
LuaCheckParam( L, 2, sAx1) ;
|
||||
double dEnd1 ;
|
||||
LuaCheckParam( L, 3, dEnd1) ;
|
||||
double dStep1 ;
|
||||
LuaCheckParam( L, 4, dStep1) ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||
int nInd = 5 + 3 * i ;
|
||||
string sAxN ;
|
||||
double dEndN ;
|
||||
double dStepN ;
|
||||
if ( LuaGetParam( L, nInd, sAxN) && LuaGetParam( L, nInd + 1, dEndN) && LuaGetParam( L, nInd + 2, dStepN))
|
||||
vAxNaEpSt.emplace_back( sAxN, dEndN, dStepN) ;
|
||||
else
|
||||
break ;
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// eseguo movimento in simulazione
|
||||
int nRes = 0 ;
|
||||
if ( m_pMchLua->m_pMchMgr != nullptr)
|
||||
nRes = m_pMchLua->m_pMchMgr->SimMoveAxes( nMoveType, vAxNaEpSt) ;
|
||||
// assegno risultato
|
||||
if ( nRes == SIM_AXMV_RES_STOP)
|
||||
return luaL_error( L, "STOP") ;
|
||||
else
|
||||
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user