EgtExecutor 2.7g2 :

- correzioni e modifiche a ExeCreateSurfBzByExtrusion.
This commit is contained in:
Dario Sassi
2025-07-22 08:31:52 +02:00
parent 901d6f7107
commit 54c761d722
3 changed files with 32 additions and 21 deletions
+26 -17
View File
@@ -2141,7 +2141,7 @@ ExeCreateSurfBzByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -2182,11 +2182,11 @@ ExeCreateSurfBzByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol
//-------------------------------------------------------------------------------
int
ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, bool bCapEnds,
double dLinTol, int nRefType)
double dLinTol, int nRefType, int* pnCount)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
nParentId = AdjustId( nParentId) ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
@@ -2200,7 +2200,6 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
// porto in locale il vettore estrusione
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
// creo la superficie e la inserisco nel DB
int nFirstId = GDB_ID_NULL ;
double dAndTolStdDeg = 15 ;
Plane3d plPlane ;
double dArea ;
@@ -2208,7 +2207,7 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
pCrv->ApproxWithLines( dLinTol, dAndTolStdDeg, ICurve::APL_STD, plApprox) ;
double dOrthoExtr = 0 ;
if ( bCapEnds && plApprox.IsClosedAndFlat( plPlane, dArea, 50 * EPS_SMALL)){
dOrthoExtr = plPlane.GetVersN() * vtExtr ;
dOrthoExtr = plPlane.GetVersN() * vtExtrL ;
if ( ( abs( dOrthoExtr) < EPS_SMALL))
return GDB_ID_NULL ;
if ( dOrthoExtr < 0)
@@ -2218,21 +2217,31 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
PtrOwner<ISurfBezier> pSbz( bOk ? GetSurfBezierByExtrusion( pCrv, vtExtrL, false, dLinTol) : nullptr ) ;
bOk = bOk && ! IsNull( pSbz) ;
// inserisco la superficie nel DB
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbz)) : GDB_ID_NULL) ;
bOk = bOk && ( nNewId != GDB_ID_NULL) ;
int nFirstId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSbz)) : GDB_ID_NULL) ;
bOk = bOk && ( nFirstId != GDB_ID_NULL) ;
int nCount = ( bOk ? 1 : 0) ;
// se richiesta chiusura agli estremi
if ( bCapEnds && bOk) {
if ( bOk && bCapEnds) {
PtrOwner<ISurfBezier> pSrfBzTop( CreateSurfBezier()) ;
pSrfBzTop->CreateByFlatContour( plApprox) ;
pSrfBzTop->Translate( vtExtrL) ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzTop)) ;
bOk = ( ! IsNull( pSrfBzTop) &&
pSrfBzTop->CreateByFlatContour( plApprox) &&
pSrfBzTop->Translate( vtExtrL)) ;
int nTopId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzTop)) : GDB_ID_NULL) ;
PtrOwner<ISurfBezier> pSrfBzBottom( CreateSurfBezier()) ;
pSrfBzBottom->CreateByFlatContour( plApprox) ;
pSrfBzBottom->Invert() ;
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzBottom)) ;
bOk = ( ! IsNull( pSrfBzBottom) &&
pSrfBzBottom->CreateByFlatContour( plApprox) &&
pSrfBzBottom->Invert()) ;
int nBotId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSrfBzBottom)) : GDB_ID_NULL) ;
if ( nTopId == GDB_ID_NULL || nBotId == GDB_ID_NULL) {
pGeomDB->Erase( nFirstId) ;
pGeomDB->Erase( nTopId) ;
pGeomDB->Erase( nBotId) ;
nFirstId = GDB_ID_NULL ;
nCount = 0 ;
}
}
if ( pnCount != nullptr)
*pnCount = nCount ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -2242,7 +2251,7 @@ ExeCreateSurfBzByExtrusion( int nParentId, int nCrvId, const Vector3d& vtExtr, b
( bCapEnds ? "true" : "false") + "," +
ToString( dLinTol) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nFirstId) ;
" -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità