diff --git a/EXE_GdbModifySurf.cpp b/EXE_GdbModifySurf.cpp index b3588da..d9b4426 100644 --- a/EXE_GdbModifySurf.cpp +++ b/EXE_GdbModifySurf.cpp @@ -368,6 +368,32 @@ ExeSurfFrOffset( int nId, double dDist, int nType) return bOk ; } +//---------------------------------------------------------------------------- +bool +ExeSurfFrOffsetAdv( int nId, double dDist, int nType, int& nNewId) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + // recupero la superficie FlatRegion + ISurfFlatRegion* pSfr = GetSurfFlatRegion( pGeomDB->GetGeoObj( nId)) ; + if ( pSfr == nullptr) + return false ; + // eseguo l'offset + PtrOwner pSfrOffs( pSfr->CreateOffsetSurf( dDist, nType)) ; + if ( IsNull( pSfrOffs)) + return false ; + // salvo la superficie di offset + nNewId = GDB_ID_NULL ; + if ( pSfr->GetChunkCount() > 0) { + // inserisco nel DB geometrico + nNewId = pGeomDB->InsertGeoObj( GDB_ID_NULL, nId, GDB_AFTER, Release( pSfrOffs)) ; + // copio gli attributi + pGeomDB->CopyAttributes( nId, nNewId) ; + ExeSetModified() ; + } + return true ; +} + //---------------------------------------------------------------------------- bool ExeSurfFrMoveSimpleNoCollision( int nId1, int nId2, const Vector3d& vtDir, double& dLen, int nRefType) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 0edd859..095266c 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_GdbModifySurf.cpp b/LUA_GdbModifySurf.cpp index f436085..5acf8d8 100644 --- a/LUA_GdbModifySurf.cpp +++ b/LUA_GdbModifySurf.cpp @@ -141,6 +141,29 @@ LuaSurfFrOffset( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaSurfFrOffsetAdv( lua_State* L) +{ + // 3 parametri : Id, dDist, nType + int nId ; + LuaCheckParam( L, 1, nId) + double dDist ; + LuaCheckParam( L, 2, dDist) + int nType = ICurve::OFF_FILLET ; + LuaGetParam( L, 3, nType) ; + LuaClearStack( L) ; + // eseguo l'offset della regione + int nNewId = GDB_ID_NULL ; + bool bOk = ExeSurfFrOffsetAdv( nId, dDist, nType, nNewId) ; + if ( bOk) + LuaSetParam( L, nNewId) ; + else + LuaSetParam( L) ; + + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaSurfTmMoveVertex( lua_State* L) @@ -451,6 +474,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffsetAdv", LuaSurfFrOffsetAdv) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;