diff --git a/EXE_BeamMgr.cpp b/EXE_BeamMgr.cpp index 6ce6694..2127352 100644 --- a/EXE_BeamMgr.cpp +++ b/EXE_BeamMgr.cpp @@ -113,12 +113,43 @@ ExeBeamSetPartBox( double dLength, double dHeight, double dWidth) //----------------------------------------------------------------------------- int ExeBeamAddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId, - const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar) + const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, bool bUpdate) { IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; VERIFY_BEAMMGR( pBeamMgr, false) - // imposto le dimensioni al pezzo corrente - return pBeamMgr->AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar) ; + // aggiungo una feature al pezzo corrente + return pBeamMgr->AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, bUpdate) ; +} + +//----------------------------------------------------------------------------- +int +ExeBeamModifyProcess( int nGeomId, int nGroup, int nProc, int nSide, const string& sDes, int nProcId, + const Frame3d& frRef, const DBLVECTOR& vdPar, const string& sPar, bool bUpdate) +{ + IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; + VERIFY_BEAMMGR( pBeamMgr, false) + // modifico una feature di un pezzo + return pBeamMgr->ModifyProcess( nGeomId, nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, bUpdate) ; +} + +//----------------------------------------------------------------------------- +bool +ExeBeamEraseProcess( int nGeomId, bool bUpdate) +{ + IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; + VERIFY_BEAMMGR( pBeamMgr, false) + // cancello una feature di un pezzo + return pBeamMgr->EraseProcess( nGeomId, bUpdate) ; +} + +//----------------------------------------------------------------------------- +bool +ExeBeamEnableProcess( int nGeomId, bool bEnable, bool bUpdate) +{ + IBeamMgr* pBeamMgr = GetCurrBeamMgr() ; + VERIFY_BEAMMGR( pBeamMgr, false) + // abilito la lavorazione di una feature di un pezzo + return pBeamMgr->EnableProcess( nGeomId, bEnable, bUpdate) ; } //----------------------------------------------------------------------------- diff --git a/LUA_BeamMgr.cpp b/LUA_BeamMgr.cpp index 50fe4d5..ccf281d 100644 --- a/LUA_BeamMgr.cpp +++ b/LUA_BeamMgr.cpp @@ -133,7 +133,7 @@ LuaBeamSetPartBox( lua_State* L) static int LuaBeamAddProcess( lua_State* L) { - // 8 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar + // 8 o 9 parametri : nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, bUpdate] int nGroup ; LuaCheckParam( L, 1, nGroup) int nProc ; @@ -150,9 +150,11 @@ LuaBeamAddProcess( lua_State* L) LuaCheckParam( L, 7, vdPar) string sPar ; LuaCheckParam( L, 8, sPar) + bool bUpdate = true ; + LuaGetParam( L, 9, bUpdate) ; LuaClearStack( L) ; // aggiungo la feature indicata - int nNewId = ExeBeamAddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar) ; + int nNewId = ExeBeamAddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, bUpdate) ; // restituisco il risultato if ( nNewId != GDB_ID_NULL) LuaSetParam( L, nNewId) ; @@ -161,6 +163,78 @@ LuaBeamAddProcess( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaBeamModifyProcess( lua_State* L) +{ + // 9 o 10 parametri : nGeomId, nGroup, nProc, nSide, sDes, nProcId, vdPar, sPar [, bUpdate] + int nGeomId ; + LuaCheckParam( L, 1, nGeomId) + int nGroup ; + LuaCheckParam( L, 2, nGroup) + int nProc ; + LuaCheckParam( L, 3, nProc) + int nSide ; + LuaCheckParam( L, 4, nSide) + string sDes ; + LuaCheckParam( L, 5, sDes) + int nProcId ; + LuaCheckParam( L, 6, nProcId) + Frame3d frRef ; + LuaCheckParam( L, 7, frRef) + DBLVECTOR vdPar ; + LuaCheckParam( L, 8, vdPar) + string sPar ; + LuaCheckParam( L, 9, sPar) + bool bUpdate = true ; + LuaGetParam( L, 10, bUpdate) ; + LuaClearStack( L) ; + // modifico la feature indicata + int nNewId = ExeBeamModifyProcess( nGeomId, nGroup, nProc, nSide, sDes, nProcId, frRef, vdPar, sPar, bUpdate) ; + // restituisco il risultato + if ( nNewId != GDB_ID_NULL) + LuaSetParam( L, nNewId) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaBeamEraseProcess( lua_State* L) +{ + // 1 o 2 parametri : nGeomId [, bUpdate] + int nGeomId ; + LuaCheckParam( L, 1, nGeomId) + bool bUpdate = true ; + LuaGetParam( L, 2, bUpdate) ; + LuaClearStack( L) ; + // cancello la feature indicata + bool bOk = ExeBeamEraseProcess( nGeomId, bUpdate) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaBeamEnableProcess( lua_State* L) +{ + // 2 o 3 parametri : nGeomId, bEnable [, bUpdate] + int nGeomId ; + LuaCheckParam( L, 1, nGeomId) + bool bEnable ; + LuaCheckParam( L, 2, bEnable) + bool bUpdate = true ; + LuaGetParam( L, 3, bUpdate) ; + LuaClearStack( L) ; + // abilito la lavorazione della feature indicata + bool bOk = ExeBeamEnableProcess( nGeomId, bEnable, bUpdate) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaBeamCalcSolid( lua_State* L) @@ -254,6 +328,9 @@ LuaInstallBeamMgr( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartCount", LuaBeamSetPartCount) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamSetPartBox", LuaBeamSetPartBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamAddProcess", LuaBeamAddProcess) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtBeamModifyProcess", LuaBeamModifyProcess) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEraseProcess", LuaBeamEraseProcess) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtBeamEnableProcess", LuaBeamEnableProcess) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamCalcSolid", LuaBeamCalcSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamGetSolid", LuaBeamGetSolid) ; bOk = bOk && luaMgr.RegisterFunction( "EgtBeamShowSolid", LuaBeamShowSolid) ;