diff --git a/EXE_GdbModifyVol.cpp b/EXE_GdbModifyVol.cpp index d63b894..299759b 100644 --- a/EXE_GdbModifyVol.cpp +++ b/EXE_GdbModifyVol.cpp @@ -96,13 +96,45 @@ ExeExplodeVolume( int nId, int* pnCount) return nFirstId ; } +//----------------------------------------------------------------------------- +bool +ExeVolZmapGetPartBBox( int nId, int nPart, int nFlag, BBox3d& b3Box) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero lo Zmap + IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; + if ( pVZM == nullptr) + return false ; + // recupero il bounding box della parte dell'oggetto in locale + return pVZM->GetPartLocalBBox( nPart, b3Box, nFlag) ; +} + +//----------------------------------------------------------------------------- +bool +ExeVolZmapGetPartBBoxGlob( int nId, int nPart, int nFlag, BBox3d& b3Box) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero lo Zmap + IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; + if ( pVZM == nullptr) + return false ; + // recupero il riferimento globale del gruppo cui appartiene + Frame3d frGlob ; + if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob)) + return false ; + // recupero il bounding box della parte dell'oggetto in globale + return pVZM->GetPartBBox( nPart, frGlob, b3Box, nFlag) ; +} + //------------------------------------------------------------------------------- int ExeCopyVolZmapPart( int nId, int nPart, int nDestGrpId) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) - // recupero lo Zmap e copio la parte indicata + // recupero lo Zmap IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; if ( pVZM == nullptr) return GDB_ID_NULL ; diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 6f7a0ff..6fcacc0 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_GdbModifySurf.cpp b/LUA_GdbModifySurf.cpp index e8ed8d1..4ed44fe 100644 --- a/LUA_GdbModifySurf.cpp +++ b/LUA_GdbModifySurf.cpp @@ -347,7 +347,7 @@ LuaSurfTmGetFacetBBoxGlob( lua_State* L) int nFlag ; LuaCheckParam( L, 3, nFlag) LuaClearStack( L) ; - // recupero il bounding box della faccia in locale + // recupero il bounding box della faccia in globale BBox3d b3Box ; bool bOk = ExeSurfTmGetFacetBBoxGlob( nId, nFacet, nFlag, b3Box) ; // restituisco il risultato diff --git a/LUA_GdbModifyVol.cpp b/LUA_GdbModifyVol.cpp index 9ae74ff..fc9bbeb 100644 --- a/LUA_GdbModifyVol.cpp +++ b/LUA_GdbModifyVol.cpp @@ -39,6 +39,52 @@ LuaExplodeVolume( lua_State* L) return 2 ; } +//---------------------------------------------------------------------------- +static int +LuaVolZmapGetPartBBox( lua_State* L) +{ + // 3 parametri : nId, nPart, nFlag + int nId ; + LuaCheckParam( L, 1, nId) + int nPart ; + LuaCheckParam( L, 2, nPart) + int nFlag ; + LuaCheckParam( L, 3, nFlag) + LuaClearStack( L) ; + // recupero il bounding box della parte in locale + BBox3d b3Box ; + bool bOk = ExeVolZmapGetPartBBox( nId, nPart, nFlag, b3Box) ; + // restituisco il risultato + if ( bOk) + LuaSetParam( L, b3Box) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//---------------------------------------------------------------------------- +static int +LuaVolZmapGetPartBBoxGlob( lua_State* L) +{ + // 3 parametri : nId, nPart, nFlag + int nId ; + LuaCheckParam( L, 1, nId) + int nPart ; + LuaCheckParam( L, 2, nPart) + int nFlag ; + LuaCheckParam( L, 3, nFlag) + LuaClearStack( L) ; + // recupero il bounding box della parte in globale + BBox3d b3Box ; + bool bOk = ExeVolZmapGetPartBBoxGlob( nId, nPart, nFlag, b3Box) ; + // restituisco il risultato + if ( bOk) + LuaSetParam( L, b3Box) ; + else + LuaSetParam( L) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaCopyVolZmapPart( lua_State* L) @@ -478,6 +524,8 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr) { bool bOk = ( &luaMgr != nullptr) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetPartBBox", LuaVolZmapGetPartBBox) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetPartBBoxGlob", LuaVolZmapGetPartBBoxGlob) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyVolZmapPart", LuaCopyVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;