diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index a8fc384..8993009 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1288,6 +1288,43 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d return nNewId ; } +//------------------------------------------------------------------------------- +int +ExeCreateSurfTmTransSwept( 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 ? GetSurfTriMeshTransSwept( 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 = "EgtSurfTmTransSwept(" + 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, int nType, double dLinTol) diff --git a/LUA_GdbCreateSurf.cpp b/LUA_GdbCreateSurf.cpp index d703099..f0c8cbc 100644 --- a/LUA_GdbCreateSurf.cpp +++ b/LUA_GdbCreateSurf.cpp @@ -682,6 +682,32 @@ LuaCreateSurfTmSwept( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaCreateSurfTmTransSwept( 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_SRF ; + LuaGetParam( L, 5, dLinTol) ; + LuaClearStack( L) ; + // creo STM swept di traslazione + int nId = ExeCreateSurfTmTransSwept( 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) @@ -993,6 +1019,7 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByScrewing", LuaCreateSurfTmByScrewing) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRectSwept", LuaCreateSurfTmRectSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwept", LuaCreateSurfTmSwept) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmTransSwept", LuaCreateSurfTmTransSwept) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRuled", LuaCreateSurfTmRuled) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByTriangles", LuaCreateSurfTmByTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmBySewing", LuaCreateSurfTmBySewing) ;