From 2a106c4263289142e21de183b6bceca62c7a5c3c Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Wed, 6 Mar 2024 16:28:48 +0100 Subject: [PATCH 1/5] EgtExecutor : - Codice di test per RMF. --- EXE_GdbCreateSurf.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 9ece426..3b39f0b 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -33,6 +33,12 @@ #include "/EgtDev/Include/EGkCurveLocal.h" #include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EGkExtText.h" + +// TEMP ********************* +#include "EgtDev/EgtGeomKernel/RotationMinimizeFrame.h" // togliere ! +#include "EgtDev/EgtGeomKernel/RotationMinimizeFrame.cpp" +// ************************** + using namespace std ; //------------------------------------------------------------------------------- @@ -1271,6 +1277,34 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ; // inserisco la superficie trimesh nel DB int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; + + + // TEMP ***************************************** + if ( nNewId == -1) { + PtrOwner pCrv( CrvGuide.Get()->Clone()) ; + if ( IsNull( pCrv)) + return false ; + Point3d ptStart ; Vector3d vtTan ; + if ( ! pCrv->GetPointD1D2( 0., ICurve::FROM_MINUS, ptStart, &vtTan)) + return false ; + Frame3d frStart ; + frStart.Set( ptStart, vtTan) ; // la tangente è la Z del frame + double dStep = 10 ; + RotationMinimizeFrame RMF( pCrv, frStart, dStep) ; + FRAME3DVECTOR vRMF ; + if ( ! RMF.GetFrames( vRMF)) + return false ; + // disegno i frames ricavati + for ( int i = 0 ; i < int( vRMF.size()) ; ++ i) { + IGeoFrame3d* frCurr( CreateGeoFrame3d()) ; + frCurr->Set( vRMF[i]) ; + pGeomDB->AddGeoObj( GDB_ID_NULL, 764, frCurr->Clone()) ; + delete( frCurr) ; + } + } + // ********************************************** + + ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { From a27dfd2b5429a1a325d8bb5a6e59d7436f643777 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Thu, 7 Mar 2024 10:52:39 +0100 Subject: [PATCH 2/5] EgtExecutor : - Codice di test per RMF aggiornato. --- EXE_GdbCreateSurf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 3b39f0b..c60a2d5 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1298,7 +1298,7 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d for ( int i = 0 ; i < int( vRMF.size()) ; ++ i) { IGeoFrame3d* frCurr( CreateGeoFrame3d()) ; frCurr->Set( vRMF[i]) ; - pGeomDB->AddGeoObj( GDB_ID_NULL, 764, frCurr->Clone()) ; + pGeomDB->AddGeoObj( GDB_ID_NULL, 3, frCurr->Clone()) ; delete( frCurr) ; } } From 82633bf725732d9969e824ada4415cdfc46f2d83 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Mon, 11 Mar 2024 13:21:29 +0100 Subject: [PATCH 3/5] EgtExecutor : - migliorie al codice. --- EXE_GdbCreateSurf.cpp | 124 ++++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 58 deletions(-) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index c60a2d5..66658d9 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1,4 +1,4 @@ -//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- // EgalTech 2014-2015 //---------------------------------------------------------------------------- // File : EXE_GdbCreateSurf.cpp Data : 04.05.15 Versione : 1.6e1 @@ -85,7 +85,7 @@ ExeCreateSurfFrRectangle( int nParentId, const Point3d& ptIni, const Point3d& pt " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -136,7 +136,7 @@ ExeCreateSurfFrRectangle3P( int nParentId, const Point3d& ptIni, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -185,7 +185,7 @@ ExeCreateSurfFrStadium( int nParentId, const Point3d& ptIni, const Point3d& ptCr " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -202,7 +202,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef // porto in locale il punto e calcolo la normale in locale Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ; Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; - // calcolo riferimento per l'entità + // calcolo riferimento per l'entità Frame3d frEnt ; bOk = bOk && frEnt.Set( ptOrigL, vtNL) ; // creo il disco nel suo riferimento intrinseco @@ -222,7 +222,7 @@ ExeCreateSurfFrDisk( int nParentId, const Point3d& ptOrig, double dRad, int nRef " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -266,7 +266,7 @@ ExeCreateSurfFrFatCurve( int nParentId, int nCrvId, double dRad, bool bSquaredEn " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -322,7 +322,7 @@ MyCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount) // recupero la prossima superficie pSfr = SfrCntr.GetSurf() ; } - // restituisco l'identificativo della prima nuova entità + // restituisco l'identificativo della prima nuova entità if ( pnCount != nullptr) *pnCount = nCount ; return nFirstId ; @@ -345,7 +345,7 @@ ExeCreateSurfFlatRegion( int nParentId, const INTVECTOR& vCrvIds, int* pnCount) " -- Id=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nFirstId ; } @@ -394,7 +394,7 @@ ExeCreateSurfTmPlaneInBBox( int nParentId, const Point3d& ptP, const Vector3d& v " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -455,7 +455,7 @@ MyCreateSewPolygon( ISurfTriMesh* pStm, const Polygon3d& Polyg) // verifico esistenza superficie if ( pStm == nullptr) return false ; - // se poligono vuoto, non devo fare alcunché + // se poligono vuoto, non devo fare alcunché if ( Polyg.GetSideCount() == 0) return true ; // creo la superficie trimesh del poligono @@ -585,7 +585,7 @@ ExeCreateSurfTmConvexHullInBBox( int nParentId, int nId, const BBox3d& b3Box, in " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -633,7 +633,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, bool bRegular, int nRef " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -688,7 +688,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -745,7 +745,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -787,7 +787,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -829,7 +829,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -865,7 +865,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -907,7 +907,7 @@ ExeCreateSurfTmTriangle( int nParentId, const Point3d& ptP1, const Point3d& ptP2 " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -956,7 +956,7 @@ ExeCreateSurfTmRectangle( int nParentId, const Point3d& ptO, const Point3d& ptL, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -987,7 +987,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol) " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1033,7 +1033,7 @@ ExeCreateSurfTmByRegion( int nParentId, const INTVECTOR& vCrvIds, double dLinTol " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1088,7 +1088,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, const INTVECTOR& vCrvIds, const Vecto " -- Id=" + ToString( nFirstId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nFirstId ; } @@ -1132,7 +1132,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, const INTVECTOR& vCrvIds, const " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1172,7 +1172,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1214,7 +1214,7 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId, " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1251,7 +1251,7 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1279,30 +1279,38 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; - // TEMP ***************************************** - if ( nNewId == -1) { - PtrOwner pCrv( CrvGuide.Get()->Clone()) ; - if ( IsNull( pCrv)) - return false ; - Point3d ptStart ; Vector3d vtTan ; - if ( ! pCrv->GetPointD1D2( 0., ICurve::FROM_MINUS, ptStart, &vtTan)) - return false ; - Frame3d frStart ; - frStart.Set( ptStart, vtTan) ; // la tangente è la Z del frame - double dStep = 10 ; - RotationMinimizeFrame RMF( pCrv, frStart, dStep) ; - FRAME3DVECTOR vRMF ; - if ( ! RMF.GetFrames( vRMF)) - return false ; - // disegno i frames ricavati - for ( int i = 0 ; i < int( vRMF.size()) ; ++ i) { - IGeoFrame3d* frCurr( CreateGeoFrame3d()) ; - frCurr->Set( vRMF[i]) ; - pGeomDB->AddGeoObj( GDB_ID_NULL, 3, frCurr->Clone()) ; - delete( frCurr) ; - } + /* RIMUOVERE ! */ + PtrOwner pCrv( CrvGuide.Get()->Clone()) ; + if ( IsNull( pCrv)) + return false ; + Point3d ptStart ; Vector3d vtTan ; + if ( ! pCrv->GetPointD1D2( 0., ICurve::FROM_MINUS, ptStart, &vtTan)) + return false ; + Frame3d frStart ; + frStart.Set( ptStart, vtTan) ; // la tangente è la Z del frame + double dStep = 5 ; + RotationMinimizeFrame RMF( pCrv, frStart, dStep) ; + FRAME3DVECTOR vRMF ; + if ( ! RMF.GetFrames( vRMF)) + return false ; + // disegno i frames ricavati + for ( int i = 0 ; i < int( vRMF.size()) ; ++ i) { + IGeoFrame3d* frCurr( CreateGeoFrame3d()) ; + frCurr->Set( vRMF[i]) ; + /* + Vector3d vtH = vRMF[i].VersZ() ; + vtH.z = 0 ; + vtH.Normalize() ; + Frame3d frCCCCCC ; frCCCCCC.Set( vRMF[i].Orig(), vtH, Z_AX ^ vtH) ; + frCurr->Set( frCCCCCC) ; + */ + pGeomDB->AddGeoObj( GDB_ID_NULL, 3, frCurr->Clone()) ; + delete( frCurr) ; } - // ********************************************** + /* RIMUOVERE ! */ + + + ExeSetModified() ; @@ -1316,7 +1324,7 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1353,7 +1361,7 @@ ExeCreateSurfTmTransSwept( int nParentId, int nSectId, int nGuideId, bool bCapEn " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1370,7 +1378,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // creo la superficie trimesh ISurfTriMesh* pSTM = nullptr ; - // se la prima entità è un punto e la seconda una curva + // se la prima entità è un punto e la seconda una curva if ( pGeomDB->GetGeoType( nPtOrCrvId1) == GEO_PNT3D && ( pGeomDB->GetGeoType( nPtOrCrvId2) & GEO_CURVE) != 0) { // recupero il punto in locale @@ -1386,7 +1394,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType // calcolo la superficie pSTM = ( bOk ? GetSurfTriMeshRuled( ptP, CrvLoc, dLinTol) : nullptr) ; } - // se la prima entità è una curva e la seconda un punto + // se la prima entità è una curva e la seconda un punto else if ( ( pGeomDB->GetGeoType( nPtOrCrvId1) & GEO_CURVE) != 0 && pGeomDB->GetGeoType( nPtOrCrvId2) == GEO_PNT3D) { // recupero la curva in locale @@ -1430,7 +1438,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, int nType " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nNewId ; } @@ -1541,7 +1549,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase) bOk = bOk && pGeomDB->GetGlobFrame( nId, frStmS) ; // lo esprimo rispetto a quello della prima superficie frStmS.ToLoc( frLoc) ; - // se è la prima, copio + // se è la prima, copio if ( bFirst) { bOk = bOk && pStm->CopyFrom( pStmS) ; bOk = bOk && pStm->ToGlob( frStmS) ; @@ -1730,7 +1738,7 @@ ExeCreateSurfBezier( int nParentId, int nDegU, int nDegV, int nSpanU, int nSpanV " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nId ; } @@ -1782,7 +1790,7 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } - // restituisco l'identificativo della nuova entità + // restituisco l'identificativo della nuova entità return nId ; } From 88fa7ef54cb3e8bd779be791807b9ac1b29c8841 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Fri, 15 Mar 2024 13:18:48 +0100 Subject: [PATCH 4/5] EgtExecutor : - rimozione codici di test. - modifiche parametri LuaCreateSurfTmSwept. --- EXE_GdbCreateSurf.cpp | 75 +++++++++++++++++-------------------------- LUA_GdbCreateSurf.cpp | 10 ++++-- 2 files changed, 36 insertions(+), 49 deletions(-) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index 66658d9..dbfe09b 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -34,11 +34,6 @@ #include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EGkExtText.h" -// TEMP ********************* -#include "EgtDev/EgtGeomKernel/RotationMinimizeFrame.h" // togliere ! -#include "EgtDev/EgtGeomKernel/RotationMinimizeFrame.cpp" -// ************************** - using namespace std ; //------------------------------------------------------------------------------- @@ -1257,7 +1252,7 @@ ExeCreateSurfTmRectSwept( int nParentId, double dDimH, double dDimV, double dBev //------------------------------------------------------------------------------- int -ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol) +ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, double dLinTol, Vector3d* vtStatic) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1266,52 +1261,40 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; - // recupero la sezione in locale - CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ; - bOk = bOk && ( CrvSect.Get() != nullptr) ; // recupero la guida in locale CurveLocal CrvGuide( pGeomDB, nGuideId, frLoc) ; bOk = bOk && ( CrvGuide.Get() != nullptr) ; - // creo la superficie trimesh + // inizializzazione superficie e suo Id ISurfTriMesh* pSTM = nullptr ; - pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol) : nullptr) ; - // inserisco la superficie trimesh nel DB - int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; + int nNewId = GDB_ID_NULL ; + // recupero il tipo di entità della sezione + int nSecType = pGeomDB->GetGeoType( nSectId) ; - - /* RIMUOVERE ! */ - PtrOwner pCrv( CrvGuide.Get()->Clone()) ; - if ( IsNull( pCrv)) - return false ; - Point3d ptStart ; Vector3d vtTan ; - if ( ! pCrv->GetPointD1D2( 0., ICurve::FROM_MINUS, ptStart, &vtTan)) - return false ; - Frame3d frStart ; - frStart.Set( ptStart, vtTan) ; // la tangente è la Z del frame - double dStep = 5 ; - RotationMinimizeFrame RMF( pCrv, frStart, dStep) ; - FRAME3DVECTOR vRMF ; - if ( ! RMF.GetFrames( vRMF)) - return false ; - // disegno i frames ricavati - for ( int i = 0 ; i < int( vRMF.size()) ; ++ i) { - IGeoFrame3d* frCurr( CreateGeoFrame3d()) ; - frCurr->Set( vRMF[i]) ; - /* - Vector3d vtH = vRMF[i].VersZ() ; - vtH.z = 0 ; - vtH.Normalize() ; - Frame3d frCCCCCC ; frCCCCCC.Set( vRMF[i].Orig(), vtH, Z_AX ^ vtH) ; - frCurr->Set( frCCCCCC) ; - */ - pGeomDB->AddGeoObj( GDB_ID_NULL, 3, frCurr->Clone()) ; - delete( frCurr) ; + // controllo se la sezione è definita da una curva + if ( nSecType == CRV_LINE || nSecType == CRV_ARC || + nSecType == CRV_BEZIER || nSecType == CRV_COMPO) { + // recupero la sezione in locale + CurveLocal CrvSect( pGeomDB, nSectId, frLoc) ; + bOk = bOk && ( CrvSect.Get() != nullptr) ; + // calcolo la Swept + pSTM = ( bOk ? GetSurfTriMeshSwept( CrvSect, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ; + // inserisco la superficie trimesh nel DB + nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; + } + // controllo se la sezione è definita da una regione piana + else if ( nSecType == SRF_FLATRGN) { + // recupero la sezione e la porto nel frame corrente + ISurfFlatRegion* pSfrSec = GetSurfFlatRegion( pGeomDB->GetGeoObj( nSectId)) ; + Frame3d frSec ; + if ( pSfrSec != nullptr && pGeomDB->GetGlobFrame( nSectId, frSec) && + pSfrSec->LocToLoc( frSec, frLoc)) { + // calcolo la Swept + pSTM = ( bOk ? GetSurfTriMeshSwept( pSfrSec, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ; + // inserisco la superficie trimesh nel DB + nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; + } + delete( pSfrSec) ; } - /* RIMUOVERE ! */ - - - - ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente diff --git a/LUA_GdbCreateSurf.cpp b/LUA_GdbCreateSurf.cpp index 1efa9da..579e635 100644 --- a/LUA_GdbCreateSurf.cpp +++ b/LUA_GdbCreateSurf.cpp @@ -660,7 +660,7 @@ LuaCreateSurfTmRectSwept( lua_State* L) static int LuaCreateSurfTmSwept( lua_State* L) { - // 4 o 5 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] + // 4, 5 o 6 parametri : ParentId, SectId, GuideId, bCapEnds [, dTol] [, vtStatic] int nParentId ; LuaCheckParam( L, 1, nParentId) int nSectId ; @@ -670,10 +670,14 @@ LuaCreateSurfTmSwept( lua_State* L) bool bCapEnds ; LuaCheckParam( L, 4, bCapEnds) double dLinTol = LIN_TOL_SRF ; - LuaGetParam( L, 5, dLinTol) ; + Vector3d vtStatic = V_INVALID ; + if ( LuaGetParam( L, 5, dLinTol)) { + LuaGetParam( L, 6, vtStatic) ; + } LuaClearStack( L) ; // creo STM swept - int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol) ; + int nId = ExeCreateSurfTmSwept( nParentId, nSectId, nGuideId, bCapEnds, dLinTol, + vtStatic.IsValid() ? &vtStatic : nullptr) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; From 824e6e3ba1ff03936d2150d5660a8e1ff27b24e6 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Mon, 18 Mar 2024 13:21:21 +0100 Subject: [PATCH 5/5] EgtExecutor : - correzione codice. --- EXE_GdbCreateSurf.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index dbfe09b..912f254 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -1284,16 +1284,15 @@ ExeCreateSurfTmSwept( int nParentId, int nSectId, int nGuideId, bool bCapEnds, d // controllo se la sezione è definita da una regione piana else if ( nSecType == SRF_FLATRGN) { // recupero la sezione e la porto nel frame corrente - ISurfFlatRegion* pSfrSec = GetSurfFlatRegion( pGeomDB->GetGeoObj( nSectId)) ; + PtrOwner pSfrSec( CloneSurfFlatRegion( pGeomDB->GetGeoObj( nSectId))) ; Frame3d frSec ; - if ( pSfrSec != nullptr && pGeomDB->GetGlobFrame( nSectId, frSec) && + if ( ! IsNull( pSfrSec) && pGeomDB->GetGlobFrame( nSectId, frSec) && pSfrSec->LocToLoc( frSec, frLoc)) { // calcolo la Swept pSTM = ( bOk ? GetSurfTriMeshSwept( pSfrSec, CrvGuide, bCapEnds, dLinTol, vtStatic) : nullptr) ; // inserisco la superficie trimesh nel DB nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ; } - delete( pSfrSec) ; } ExeSetModified() ;