From 54c761d722db0ee287d130fa5c1eb2a45417cf94 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 22 Jul 2025 08:31:52 +0200 Subject: [PATCH] EgtExecutor 2.7g2 : - correzioni e modifiche a ExeCreateSurfBzByExtrusion. --- EXE_GdbCreateSurf.cpp | 43 +++++++++++++++++++++++++----------------- EgtExecutor.rc | Bin 18890 -> 18890 bytes LUA_GdbCreateSurf.cpp | 10 ++++++---- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 7ab640e..4e8fe44 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -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 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 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 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à diff --git a/EgtExecutor.rc b/EgtExecutor.rc index 3473e1233fa7728187ea6c2637e65c45e5019507..5a3e3722ab119d91aeb4fe39629542f100ea47f2 100644 GIT binary patch delta 81 zcmX>#neo(Q#tpyN7>zdnW^-i*QjT29S-`yGOp`YVRxuh)cH~Ol+$UrM5m>XaK delta 81 zcmX>#neo(Q#tpyN7!5c7W^-i*QjT29S-`yGOp`YVRxuh*cH~Ol+$UrM5