From 285da9d4e845984437582369190d4fd1054a829d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 11 Feb 2016 10:21:25 +0000 Subject: [PATCH] EgtExecutor 1.6n3 : - modifiche per gestione fasi di lavorazione (EXE e LUA). --- EXE_GeomDB.cpp | 5 ++- EXE_MachMgr.cpp | 61 ++++++++++++++++++++++++++++++++++++ EgtExecutor.rc | Bin 11694 -> 11694 bytes LUA_MachMgr.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 1 deletion(-) diff --git a/EXE_GeomDB.cpp b/EXE_GeomDB.cpp index 5569ffa..2ae3103 100644 --- a/EXE_GeomDB.cpp +++ b/EXE_GeomDB.cpp @@ -348,14 +348,17 @@ ExeSaveFile( const string& sFilePath, int nFlag) VERIFY_CTX_GEOMDB( pGseCtx, false) // se ero in CAM, esco int nCurrMachGroup = ExeGetCurrMachGroup() ; + int nCurrPhase = ExeGetCurrPhase() ; ExeResetCurrMachGroup() ; // imposto path corrente del file pGseCtx->m_sFilePath = sFilePath ; // salvo il file bool bOk = pGseCtx->m_pGeomDB->Save( GDB_ID_ROOT, sFilePath, nFlag) ; // eventuale ripristino precedente CAM - if ( nCurrMachGroup != GDB_ID_NULL) + if ( nCurrMachGroup != GDB_ID_NULL) { ExeSetCurrMachGroup( nCurrMachGroup) ; + ExeSetCurrPhase( nCurrPhase) ; + } // aggiorno stato file corrente if ( bOk) ExeResetModified() ; diff --git a/EXE_MachMgr.cpp b/EXE_MachMgr.cpp index d1a25c6..4baba81 100644 --- a/EXE_MachMgr.cpp +++ b/EXE_MachMgr.cpp @@ -228,6 +228,48 @@ ExeGetCurrMachGroup( void) return pMachMgr->GetCurrMachGroup() ; } +//----------------------------------------------------------------------------- +// Phases +//----------------------------------------------------------------------------- +int +ExeAddPhase( void) +{ + IMachMgr* pMachMgr = GetCurrMachMgr() ; + VERIFY_MACHMGR( pMachMgr, 0) + // aggiungo una nuova fase di lavorazione alla macchinata corrente + return pMachMgr->AddPhase() ; +} + +//----------------------------------------------------------------------------- +bool +ExeSetCurrPhase( int nPhase) +{ + IMachMgr* pMachMgr = GetCurrMachMgr() ; + VERIFY_MACHMGR( pMachMgr, false) + // imposto la fase di lavorazione corrente nella macchinata corrente + return pMachMgr->SetCurrPhase( nPhase) ; +} + +//----------------------------------------------------------------------------- +int +ExeGetCurrPhase( void) +{ + IMachMgr* pMachMgr = GetCurrMachMgr() ; + VERIFY_MACHMGR( pMachMgr, false) + // recupero la fase di lavorazione corrente nella macchinata corrente + return pMachMgr->GetCurrPhase() ; +} + +//----------------------------------------------------------------------------- +int +ExeGetPhaseCount( void) +{ + IMachMgr* pMachMgr = GetCurrMachMgr() ; + VERIFY_MACHMGR( pMachMgr, 0) + // recupero il numero totale di fasi di lavorazione della macchinata corrente + return pMachMgr->GetPhaseCount() ; +} + //----------------------------------------------------------------------------- // Raw Parts & Parts //----------------------------------------------------------------------------- @@ -360,6 +402,25 @@ ExeModifyRawPartHeight( int nRawId, double dHeight) return bOk ; } +//----------------------------------------------------------------------------- +bool +ExeKeepRawPart( int nRawId) +{ + GseContext* pGseCtx = GetCurrGseContext() ; + VERIFY_CTX_MACHMGR( pGseCtx, false) + // confermo il grezzo nella fase corrente della macchinata corrente + bool bOk = pGseCtx->m_pMachMgr->KeepRawPart( nRawId) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtKeepRawPart(" + ToString( nRawId) + ")" + + " -- Ok=" + ToString( bOk) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco il risultato + return bOk ; +} + //----------------------------------------------------------------------------- bool ExeRemoveRawPart( int nRawId) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index f93716706982fc253d1ed3c151f81ef0e19a3909..a15b5c8bd68cf68846e97ad78f0834dce169eeba 100644 GIT binary patch delta 97 zcmZ1%y)JsgA2vqg%@@V4Gflq2na5~6Ignd-a{*Tk3sCf++-0W82LxfF21;&>n->Y| cF@rU@0x76sKgP|Iq`|@mn->Y| cF@rU@0x76sKgP|Iq`|@m 0) + LuaSetParam( L, nPhase) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaSetCurrPhase( lua_State* L) +{ + // 1 parametro : nPhase + int nPhase ; + LuaCheckParam( L, 1, nPhase) + LuaClearStack( L) ; + // imposto la fase di lavorazione corrente nella macchinata corrente + bool bOk = ExeSetCurrPhase( nPhase) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaGetCurrPhase( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // recupero la fase di lavorazione corrente nella macchinata corrente + int nCount = ExeGetCurrPhase() ; + // restituisco il risultato + LuaSetParam( L, nCount) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaGetPhaseCount( lua_State* L) +{ + // nessun parametro + LuaClearStack( L) ; + // recupero il numero totale di fasi di lavorazione nella macchinata corrente + int nCount = ExeGetPhaseCount() ; + // restituisco il risultato + LuaSetParam( L, nCount) ; + return 1 ; +} + //------------------------------------------------------------------------------- // Raw Parts & Parts //------------------------------------------------------------------------------- @@ -358,6 +417,21 @@ LuaModifyRawPartHeight( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaKeepRawPart( lua_State* L) +{ + // 1 parametro : nRawId + int nRawId ; + LuaCheckParam( L, 1, nRawId) + LuaClearStack( L) ; + // confermo il grezzo nella fase corrente della macchinata corrente + bool bOk = ExeKeepRawPart( nRawId) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaRemoveRawPart( lua_State* L) @@ -1978,6 +2052,11 @@ LuaInstallMachMgr( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrMachGroup", LuaSetCurrMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtResetCurrMachGroup", LuaResetCurrMachGroup) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrMachGroup", LuaGetCurrMachGroup) ; + // Phases + bOk = bOk && luaMgr.RegisterFunction( "EgtAddPhase", LuaAddPhase) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSetCurrPhase", LuaSetCurrPhase) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetCurrPhase", LuaGetCurrPhase) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtGetPhaseCount", LuaGetPhaseCount) ; // Raw Parts & Parts bOk = bOk && luaMgr.RegisterFunction( "EgtGetRawPartCount", LuaGetRawPartCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ; @@ -1986,6 +2065,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ; bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartHeight", LuaModifyRawPartHeight) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtKeepRawPart", LuaKeepRawPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveRawPart", LuaRemoveRawPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRotateRawPart", LuaRotateRawPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMoveToCornerRawPart", LuaMoveToCornerRawPart) ;