EgtExecutor :

- prime sistemazioni per offset superfici trimesh tramite Zmap
- eliminate funzioni exe/lua CreateVolZmapFromSurfTmOffset e CreateVolZmapFromSurfTmThickeningOffset.
This commit is contained in:
Dario Sassi
2025-07-07 14:59:59 +02:00
parent 92a6b54666
commit c36ce0a26f
7 changed files with 276 additions and 472 deletions
+1 -127
View File
@@ -20,9 +20,7 @@
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkDistPointLine.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
@@ -1492,7 +1490,7 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, const Vector3d&
}
// controllo se la sezione è definita da una regione piana
else if ( nSecType == SRF_FLATRGN) {
// recupero la regione sezion in locale
// recupero la regione sezione in locale
SurfLocal SrfSect( pGeomDB, nSectId, frLoc) ;
const ISurfFlatRegion* pSFrSect = GetSurfFlatRegion( SrfSect.Get()) ;
bOk = bOk && ( pSFrSect != nullptr) ;
@@ -1834,130 +1832,6 @@ ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vStmIds[0], frSurf))
return GDB_ID_NULL ;
// recupero il riferimento di locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale alla prima
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
// recupero la superficie TriMesh
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( vStmIds[i]) ;
if ( pGeoObj->GetType() != SRF_TRIMESH)
return GDB_ID_NULL ;
// recupero una copia della superficie TriMesh e la porto il locale
ISurfTriMesh* pStm = CloneSurfTriMesh( GetSurfTriMesh( pGeoObj)) ;
if ( pStm != nullptr) {
pStm->LocToLoc( frSurf, frLoc) ;
vpStm.emplace_back( pStm) ;
}
}
// recupero la superficie risultante
int nId = GDB_ID_NULL ;
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesOffset( vpStm, dOffs, dLinTol, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
// dealloco le superfici
for ( auto& pStm : vpStm) {
delete ( pStm) ;
pStm = nullptr ;
}
if ( bOk)
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
for ( int i = 0 ; i < int( vpStm.size()) ; ++ i) {
if ( vpStm[i] != nullptr)
delete vpStm[i] ;
vpStm[i] = nullptr ;
}
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeSurfTmThickeningOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol, int nType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// se non ci sono superfici non c'è niente da calcolare
if ( vStmIds.empty())
return GDB_ID_NULL ;
// recupero il riferimento della prima superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( vStmIds[0], frSurf))
return GDB_ID_NULL ;
// recupero il riferimento di locale
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
return GDB_ID_NULL ;
// recupero le superfici TriMesh e le porto tutte in locale alla prima
CISURFTMPVECTOR vpStm ; vpStm.reserve( vStmIds.size()) ;
for ( int i = 0 ; i < int( vStmIds.size()) ; ++ i) {
// recupero la superficie TriMesh
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( vStmIds[i]) ;
if ( pGeoObj->GetType() != SRF_TRIMESH)
return GDB_ID_NULL ;
// recupero una copia della superficie TriMesh e la porto il locale
ISurfTriMesh* pStm = CloneSurfTriMesh( GetSurfTriMesh( pGeoObj)) ;
if ( pStm != nullptr) {
pStm->LocToLoc( frSurf, frLoc) ;
vpStm.emplace_back( pStm) ;
}
}
// recupero la superficie risultante
int nId = GDB_ID_NULL ;
PtrOwner<ISurfTriMesh> pStmOffs( CreateSurfTriMeshesThickeningOffset( vpStm, dOffs, dLinTol, nType)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
// dealloco le superfici
for ( auto& pStm : vpStm) {
delete ( pStm) ;
pStm = nullptr ;
}
if ( bOk)
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmThickeningOffset(" + ToString( nParentId) + ")" +
ToString( vStmIds) + "," +
ToString( dOffs) + "," +
ToString( dLinTol) + "," +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
for ( int i = 0 ; i < int( vpStm.size()) ; ++ i) {
if ( vpStm[i] != nullptr)
delete vpStm[i] ;
vpStm[i] = nullptr ;
}
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV, const PNTVECTOR& vPnt, int nRefType)