From 83acce1b414cc51d3af6cc2644edf0b3cd5454bb Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 13 Jul 2020 13:24:31 +0000 Subject: [PATCH] EgtExecutor 2.2g1 : - aggiunta funzione Exe e Lua VolZmapGetPartMinDist. --- EXE_GdbGetVol.cpp | 24 ++++++++++++++++++++++++ EgtExecutor.rc | Bin 16176 -> 16176 bytes LUA_GdbGetVol.cpp | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/EXE_GdbGetVol.cpp b/EXE_GdbGetVol.cpp index 49135c0..73cb6e6 100644 --- a/EXE_GdbGetVol.cpp +++ b/EXE_GdbGetVol.cpp @@ -64,3 +64,27 @@ ExeVolZmapPartVolume( int nId, int nPart, double& dVol) // restituisco il volume della eventuale parte richiesta return ( pVZM != nullptr && pVZM->GetPartVolume( nPart, dVol)) ; } + +//---------------------------------------------------------------------------- +bool +ExeVolZmapGetPartMinDist( int nId, const Point3d ptNear, int nRefType, int& nPart) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // verifico il parametro + if ( &nPart == nullptr) + return false ; + // recupero il solido Zmap + const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ; + if ( pVZM == nullptr) + return false ; + // recupero il riferimento del solido + Frame3d frVol ; + if ( ! pGeomDB->GetGlobFrame( nId, frVol)) + return false ; + // porto il punto Near nel riferimento dell'entità + Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frVol) ; + // restituisco il volume della eventuale parte richiesta + nPart = pVZM->GetPartMinDistFromPoint( ptNearL) ; + return ( nPart >= 0) ; +} diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 645036a1ec51d61fc6a4aa581d221f946a659d03..291c1168e18ffc8fc21f9842c6c4c32785f62622 100644 GIT binary patch delta 103 zcmdl`x1nysH#Syt1|0^&&A-{4nVHjp3`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(psNd^E{1s;0< delta 103 zcmdl`x1nysH#Sx?1|0^|&A-{4nVHjo3`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(psNd^F0!5)(U diff --git a/LUA_GdbGetVol.cpp b/LUA_GdbGetVol.cpp index c61c3a1..c264e0f 100644 --- a/LUA_GdbGetVol.cpp +++ b/LUA_GdbGetVol.cpp @@ -118,6 +118,28 @@ LuaVolZmapGetPartBBoxGlob( lua_State* L) return 1 ; } +//---------------------------------------------------------------------------- +static int +LuaVolZmapGetPartMinDist( lua_State* L) +{ + // 2 o 3 parametri : nId, ptNear [, nRefType] + int nId ; + LuaCheckParam( L, 1, nId) + Point3d ptNear ; + LuaCheckParam( L, 2, ptNear) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 3, nRefType) ; + LuaClearStack( L) ; + // ricerca + int nPart ; + bool bOk = ExeVolZmapGetPartMinDist( nId, ptNear, nRefType, nPart) ; + if ( bOk) + LuaSetParam( L, nPart) ; + else + LuaSetParam( L) ; + return 1 ; +} + //---------------------------------------------------------------------------- static int LuaCopyVolZmapPart( lua_State* L) @@ -207,6 +229,7 @@ LuaInstallGdbGetVol( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapPartVolume", LuaVolZmapPartVolume) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetPartBBox", LuaVolZmapGetPartBBox) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetPartBBoxGlob", LuaVolZmapGetPartBBoxGlob) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetPartMinDist", LuaVolZmapGetPartMinDist) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCopyVolZmapPart", LuaCopyVolZmapPart) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetDepth", LuaVolZmapGetDepth) ; bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetEdges", LuaVolZmapGetEdges) ;