EgtExecutor 1.8j2 :

- aggiunta fiunzione Exe e Lua CreateSurfTmByVolZmap
- aggiunte funzioni Exe e Lua CopyVolZmapPart e RemoveVolZmapPart
- aggiunte funzioni Exe e Lua SurfArea, SurfVolume, VolZmapVolume e VolZmapPartVolume.
This commit is contained in:
Dario Sassi
2017-10-06 07:54:48 +00:00
parent 4821310eb7
commit ac5772a654
7 changed files with 324 additions and 0 deletions
+62
View File
@@ -24,6 +24,7 @@
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EgkStringUtils3d.h"
#include "/EgtDev/Include/EgkGeoPoint3d.h"
#include "/EgtDev/Include/EgkCurveLocal.h"
@@ -1091,3 +1092,64 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase)
// restituisco il risultato
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il solido VolZmap
const IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nZmapId)) ;
bool bOk = ( pVZM != nullptr) ;
// se richiesta superficie di una sola parte
PtrOwner<IVolZmap> pPart ;
if ( bOk && nPart >= 0) {
pPart.Set( pVZM->ClonePart( nPart)) ;
bOk = ! IsNull( pPart) ;
pVZM = pPart ;
}
// recupero il riferimento del solido sorgente
Frame3d frSou ;
bOk = bOk && pGeomDB->GetGlobFrame( nZmapId, frSou) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// Costruttore di trimesh da insieme disordinato di triangoli
StmFromTriangleSoup StmFts ;
bOk = bOk && StmFts.Start() ;
// recupero i triangoli del bordo dello Zmap
INTVECTOR vnModif ;
TRIA3DLISTVECTOR vlTria ;
int nCount = ( bOk ? pVZM->GetBlockCount() : 0) ;
( bOk ? pVZM->GetTriangles( false, vnModif, vlTria) : false) ;
for ( int i = 0 ; i < nCount && bOk ; ++ i) {
// se blocco non modificato, vado oltre
if ( vnModif[i] < 0)
continue ;
for ( auto& Tria : vlTria[vnModif[i]]) {
// aggiusto per i sistemi di riferimento
Tria.LocToLoc( frSou, frLoc) ;
// inserisco il triangolo nella nuova superficie
if ( ! StmFts.AddTriangle( Tria))
bOk = false ;
}
}
// valido la superficie e calcolo le adiacenze
bOk = bOk && StmFts.End() ;
// inserisco la superficie trimesh nel DB
PtrOwner<ISurfTriMesh> pStm( StmFts.GetSurf()) ;
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStm)) : GDB_ID_NULL) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmByVolZmap(" + IdToString( nParentId) + "," +
IdToString( nZmapId) + "," +
IdToString( nPart) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nNewId ;
}