EgtExecutor 2.5l2 :
- aggiunta funzione Exe e Lua SurfTmGetEdges.
This commit is contained in:
+57
-2
@@ -1091,7 +1091,7 @@ ExeSurfTmGetFacetBBoxGlob( int nId, int nFacet, int nFlag, BBox3d& b3Box)
|
||||
return false ;
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frGlob ;
|
||||
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
|
||||
return false ;
|
||||
// recupero il bounding box della faccia dell'oggetto in globale
|
||||
return pStm->GetFacetBBox( nFacet, frGlob, b3Box, nFlag) ;
|
||||
@@ -1109,7 +1109,7 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
||||
return false ;
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frGlob ;
|
||||
if ( nId != GDB_ID_ROOT && ! pGeomDB->GetGroupGlobFrame( pGeomDB->GetParentId( nId), frGlob))
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frGlob))
|
||||
return false ;
|
||||
// porto il riferimento di espressione in quello della superficie
|
||||
Frame3d frGlobL = frGlob ;
|
||||
@@ -1118,6 +1118,61 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
||||
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero il riferimento globale del gruppo cui appartiene
|
||||
Frame3d frSurf ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frSurf) ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest) ;
|
||||
// ne determino gli spigoli
|
||||
ICURVEPOVECTOR vpCurve ;
|
||||
bOk = bOk && pStm->GetEdges( vpCurve) ;
|
||||
// inserisco gli spigoli come curve nel DB
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
int nCount = 0 ;
|
||||
for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) {
|
||||
// se richiesto, verifico l'angolo tra le facce adiacenti (0=allineate)
|
||||
if ( bSmoothAng) {
|
||||
double dAngInt = vpCurve[i]->GetTempParam() ;
|
||||
if ( abs( dAngInt) < pStm->GetSmoothAngle())
|
||||
continue ;
|
||||
}
|
||||
// lo porto nel riferimento destinazione
|
||||
bOk = bOk && vpCurve[i]->LocToLoc( frSurf, frDest) ;
|
||||
// lo inserisco nel DB geometrico
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( vpCurve[i])) : GDB_ID_NULL) ;
|
||||
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
|
||||
// copio il materiale
|
||||
bOk = bOk && pGeomDB->CopyMaterial( nId, nNewId) ;
|
||||
// aggiorno contatori
|
||||
if ( bOk && nFirstId == GDB_ID_NULL)
|
||||
nFirstId = nNewId ;
|
||||
if ( bOk)
|
||||
++ nCount ;
|
||||
}
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmGetEdges(" + ToString( nId) + ",{" +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultati
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfBezierGetPoint( int nSurfId, double dU, double dV, int nRefId, Point3d& ptP)
|
||||
|
||||
+2
-2
@@ -250,8 +250,8 @@ ExeVolZmapGetEdges( int nId, int nDestGrpId, int* pnCount)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtGetSurfTmSilhouette(" + ToString( nId) + ",{" +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
string sLua = "EgtVolZmapGetEdges(" + ToString( nId) + ",{" +
|
||||
ToString( nDestGrpId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -794,6 +794,33 @@ LuaCopySurfTmFacet( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetEdges( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : nId, nDestGrpId [, bSmoothAng]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 2, nDestGrpId)
|
||||
bool bSmoothAng = true ;
|
||||
LuaGetParam( L, 3, bSmoothAng) ;
|
||||
LuaClearStack( L) ;
|
||||
// calcolo gli spigoli della superficie
|
||||
int nCount ;
|
||||
int nFirstId = ExeSurfTmGetEdges( nId, nDestGrpId, bSmoothAng, &nCount) ;
|
||||
// restituisco il risultato
|
||||
if ( nFirstId != GDB_ID_NULL) {
|
||||
LuaSetParam( L, nFirstId) ;
|
||||
LuaSetParam( L, nCount) ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
LuaSetParam( L) ;
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfBezierGetPoint( lua_State* L)
|
||||
@@ -1068,6 +1095,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfTmSilhouette", LuaGetSurfTmSilhouette) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCopySurfTmFacet", LuaCopySurfTmFacet) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetEdges", LuaSurfTmGetEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPoint", LuaSurfBezierGetPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointD1", LuaSurfBezierGetPointD1) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierGetPointNrmD1", LuaSurfBezierGetPointNrmD1) ;
|
||||
|
||||
+2
-1
@@ -211,6 +211,7 @@ LuaVolZmapGetDepth( lua_State* L)
|
||||
}
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapGetEdges( lua_State* L)
|
||||
@@ -221,7 +222,7 @@ LuaVolZmapGetEdges( lua_State* L)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 2, nDestGrpId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo calcolo profondità dal punto lungo la direzione
|
||||
// calcolo gli spigoli del solido
|
||||
int nCount ;
|
||||
int nFirstId = ExeVolZmapGetEdges( nId, nDestGrpId, &nCount) ;
|
||||
// restituisco il risultato
|
||||
|
||||
Reference in New Issue
Block a user