EgtExecutor :

- ricollocazione funzioni di Offset per superfici TriMesh chiuse.
This commit is contained in:
Riccardo Elitropi
2025-06-16 13:17:31 +02:00
parent 362c845ed3
commit 9c5f48be88
4 changed files with 78 additions and 77 deletions
+57
View File
@@ -1834,6 +1834,63 @@ ExeCreateSurfTmByVolZmap( int nParentId, int nZmapId, int nPart)
return nNewId ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmOffset( int nParentId, const INTVECTOR& vStmIds, double dOffs, double dLinTol)
{
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)) ;
bool bOk = ( ! IsNull( pStmOffs) && pStmOffs->IsValid()) ;
if ( bOk)
nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pStmOffs)) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtOffsetSurfTm(" + 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)