EgtExecutor :

- aggiunta funzione per estendere un gruppo di superfici indicandone il bordo.
- piccola correzione.
This commit is contained in:
Daniele Bariletti
2026-07-22 09:27:01 +02:00
parent 58463321e0
commit 9e14c158ff
3 changed files with 100 additions and 2 deletions
+65
View File
@@ -3058,3 +3058,68 @@ ExeCreateSurfExtension( int nParentId, int nSurfId, double dExtLen, int nCrv, in
return nNewId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfExtensionFromMany( int nParentId, const INTVECTOR& vSurfId, double dExtLen, int nCrvId,
bool bDrawOffEdge, int* pnCount, int nType, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// Recupero il riferimento della prima superficie
Frame3d frSurf ;
bOk = bOk && pGeomDB->GetGlobFrame( vSurfId[0], frSurf) ;
// Recupero il riferimento dei gruppi di destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGlobFrame( nParentId, frDest) ;
// recupero le superfici e le porto in locale alla prima
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( ssize( vSurfId)) ;
CISURFPVECTOR vpSurf ;
for ( int nSurfId : vSurfId) {
const ISurfTriMesh* pSurf = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pSurf == nullptr) {
const ISurfBezier* pSurfBz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfId)) ;
if ( pSurfBz == nullptr)
return GDB_ID_NULL ;
pSurf = pSurfBz->GetAuxSurfRefined() ;
}
vSurfL.emplace_back( pGeomDB, nSurfId, frSurf) ;
vpSurf.emplace_back( vSurfL.back().Get()) ;
}
CurveLocal CrvLoc( pGeomDB, nCrvId, frSurf) ;
ICurve* pOffEdge = nullptr ;
ISurfTriMesh* pExtension = GetSurfExtensionFromMany( vpSurf, dExtLen, CrvLoc.Get(), pOffEdge, nType, dLinTol) ;
//pExtension->ToLoc( frDest) ;
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pExtension) ;
if ( nNewId != GDB_ID_NULL) {
if ( pnCount != nullptr)
++ *pnCount ;
}
if ( bDrawOffEdge && pOffEdge->IsValid()) {
int nEdgeId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pOffEdge) ;
if ( nEdgeId != GDB_ID_NULL) {
if ( pnCount != nullptr)
++ *pnCount ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfExtend(" + IdToString( nParentId) + "," +
IdListToString( vSurfId) + "," +
ToString( dExtLen) + "," +
ToString( nCrvId) + "," +
ToString( nType) + ")" +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nNewId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return nNewId ;
}