From 95f3b7e95509e2e30655180ef4943563bd821b7f Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 29 Apr 2019 11:12:49 +0000 Subject: [PATCH] EgtExecutor 2.1d3 : - aggiunte funzioni exe e lua per creare superfici swept. --- EXE_GdbCreateSurf.cpp | 37 +++++++++++++++++++++++++++++++++++++ EgtExecutor.rc | Bin 16176 -> 16176 bytes LUA_GdbCreateSurf.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 1c10579..dd5bfc2 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1119,6 +1119,43 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId, return nNewId ; } +//------------------------------------------------------------------------------- +int +ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; + bool bOk = true ; + // recupero il riferimento locale + Frame3d frLoc ; + bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; + // recupero la sezione in locale + CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ; + bOk = bOk && ( CrvSect.Get() != nullptr) ; + // recupero la guida in locale + CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ; + bOk = bOk && ( CrvGuide.Get() != nullptr) ; + // creo la superficie trimesh + ISurfTriMesh* pSTM = nullptr ; + pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ; + // inserisco la superficie trimesh nel DB + int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtSurfTmSwept(" + IdToString( nParentId) + "," + + ToString( nSectId) + "," + + ToString( nGuideId) + "," + + ( bCapEnds ? "true" : "false") + "," + + ToString( dLinTol) + ")" + + " -- Id=" + ToString( nNewId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nNewId ; +} + //------------------------------------------------------------------------------- int ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, double dLinTol) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 08edbe31a12f114202cf66eef1ad6b645226a686..65e84e821c853f3d0518420f49ccd227403c20bc 100644 GIT binary patch delta 79 zcmdl`x1nysFE&Qw&A-`PnSqoe*K!sx?>N)s4T4pS#*-bnk~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0D5;DV*mgE delta 79 zcmdl`x1nysFE&P_&A-`PnSqoe*K!sx?>N)s4T4pSMw1=6k~jAW*?>e(i-FY$N+HxV MD8kglDP58Q0C_7LTL1t6 diff --git a/LUA_GdbCreateSurf.cpp b/LUA_GdbCreateSurf.cpp index d0d0dd2..8e1094f 100644 --- a/LUA_GdbCreateSurf.cpp +++ b/LUA_GdbCreateSurf.cpp @@ -559,6 +559,33 @@ LuaCreateSurfTmByScrewing( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaCreateSurfTmSwept( lua_State* L) +{ + // 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + int nSectId ; + LuaCheckParam( L, 2, nSectId) + int nGuideId ; + LuaCheckParam( L, 3, nGuideId) + bool bCapEnds ; + LuaCheckParam( L, 4, bCapEnds) + double dLinTol = LIN_TOL_DEF ; + if ( lua_gettop( L) >= 5) + LuaCheckParam( L, 5, dLinTol) ; + LuaClearStack( L) ; + // creo STM swept + int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaCreateSurfTmRuled( lua_State* L) @@ -678,6 +705,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRegionExtrusion", LuaCreateSurfTmByRegionExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByRevolve", LuaCreateSurfTmByRevolve) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;