diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index 5c28fa6..188e27a 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -811,3 +811,73 @@ ExeApplyMachining( void) // imposto la geometria alla lavorazione corrente return pGseCtx->m_pMachMgr->Apply() ; } + +//----------------------------------------------------------------------------- +int +ExeGetFirstOperation( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero la prima operazione della macchinata corrente + return pGseCtx->m_pMachMgr->GetFirstOperation() ; +} + +//----------------------------------------------------------------------------- +int +ExeGetNextOperation( int nId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero la successiva operazione della macchinata corrente + return pGseCtx->m_pMachMgr->GetNextOperation( nId) ; +} + +//----------------------------------------------------------------------------- +int +ExeGetOperationType( int nId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // recupero il tipo di operazione della macchinata corrente + return pGseCtx->m_pMachMgr->GetOperationType( nId) ; +} + +//----------------------------------------------------------------------------- +bool +ExeSimStart( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // avvio la simulazione della macchinata corrente + return pGseCtx->m_pMachMgr->SimStart() ; +} + +//----------------------------------------------------------------------------- +bool +ExeSimMove( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // eseguo movimento di simulazione della macchinata corrente + return pGseCtx->m_pMachMgr->SimMove() ; +} + +//----------------------------------------------------------------------------- +bool +ExeSimSetStep( double dStep) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // imposto lo step di riferimento per la simulazione della macchinata corrente + return pGseCtx->m_pMachMgr->SimSetStep( dStep) ; +} + +//----------------------------------------------------------------------------- +bool +ExeSimStop( void) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // termino la simulazione della macchinata corrente + return pGseCtx->m_pMachMgr->SimStop() ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 8ef7064..0b7b2fe 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_MachMgr.cpp b/LUA_MachMgr.cpp index c6ff600..20ab5fe 100644 --- a/LUA_MachMgr.cpp +++ b/LUA_MachMgr.cpp @@ -955,6 +955,109 @@ LuaApplyMachining( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaGetFirstOperation( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // recupero la prima operazione della macchinata corrente + int nId = ExeGetFirstOperation() ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaGetNextOperation( lua_State* L) +{ + // 1 parametro : nId + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // recupero la prima operazione della macchinata corrente + int nNextId = ExeGetNextOperation( nId) ; + // restituisco il risultato + if ( nNextId != GDB_ID_NULL) + LuaSetParam( L, nNextId) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaGetOperationType( lua_State* L) +{ + // 1 parametro : nId + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // recupero la prima operazione della macchinata corrente + int nType = ExeGetOperationType( nId) ; + // restituisco il risultato + LuaSetParam( L, nType) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaSimStart( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // avvio la simulazione + bool bOk = ExeSimStart() ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaSimMove( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // eseguo movimento di simulazione + bool bOk = ExeSimMove() ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaSimSetStep( lua_State* L) +{ + // 1 parametro : dStep + double dStep ; + LuaCheckParam( L, 1, dStep) + LuaClearStack( L) ; + // imposto lo step di riferimento per la simulazione + bool bOk = ExeSimSetStep( dStep) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaSimStop( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // termino la simulazione + bool bOk = ExeSimStop() ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- bool LuaInstallMachMgr( LuaMgr& luaMgr) @@ -1009,6 +1112,13 @@ LuaInstallMachMgr( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningParam", LuaSetMachiningParam) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSetMachiningGeometry", LuaSetMachiningGeometry) ; bOk = bOk && luaMgr.RegisterFunction( "EgtApplyMachining", LuaApplyMachining) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstOperation", LuaGetFirstOperation) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextOperation", LuaGetNextOperation) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetOperationType", LuaGetOperationType) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSimStart", LuaSimStart) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSimMove", LuaSimMove) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSimSetStep", LuaSimSetStep) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSimStop", LuaSimStop) ; return bOk ; }