EgtExecutor 2.2g1 :

- aggiunta funzione Exe e Lua VolZmapGetPartMinDist.
This commit is contained in:
Dario Sassi
2020-07-13 13:24:31 +00:00
parent 7497918434
commit 83acce1b41
3 changed files with 47 additions and 0 deletions
+24
View File
@@ -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) ;
}
BIN
View File
Binary file not shown.
+23
View File
@@ -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) ;