From 3ff02fe0fe67e3f81b39c83c116373b0a6999371 Mon Sep 17 00:00:00 2001 From: SaraP Date: Tue, 12 May 2026 15:09:11 +0200 Subject: [PATCH] EgtExecutor : - nelle funzioni exe e lua ChainCurvesInGroup e ReorderCurvesInGroup aggiunta tolleranza come parametro opzionale. --- EXE_GdbModifyCurve.cpp | 11 +++++------ LUA_GdbModifyCurve.cpp | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/EXE_GdbModifyCurve.cpp b/EXE_GdbModifyCurve.cpp index 7e6d475..3a51ddf 100644 --- a/EXE_GdbModifyCurve.cpp +++ b/EXE_GdbModifyCurve.cpp @@ -2358,7 +2358,7 @@ ExeCurveCompoSetTempParam( int nId, int nCrv, double dParam, int nParamInd) //------------------------------------------------------------------------------- static bool -MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType) +MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType, double dToler) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -2368,7 +2368,6 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp)) return false ; // preparo i dati per il concatenamento - double dToler = 10 * EPS_SMALL ; ChainCurves chainC ; chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ; int nId = pGeomDB->GetFirstInGroup( nGroupId) ; @@ -2412,9 +2411,9 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in //------------------------------------------------------------------------------- bool -ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType) +ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler) { - bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ; + bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType, dToler) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { @@ -2429,9 +2428,9 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType) //------------------------------------------------------------------------------- bool -ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType) +ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler) { - bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ; + bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType, dToler) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { diff --git a/LUA_GdbModifyCurve.cpp b/LUA_GdbModifyCurve.cpp index fe8f977..04c50a6 100644 --- a/LUA_GdbModifyCurve.cpp +++ b/LUA_GdbModifyCurve.cpp @@ -409,7 +409,7 @@ LuaTrimExtendCurveByLen( lua_State* L) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; - // taglio o allungo la curva nell'estremo pił vicino al punto + // taglio o allungo la curva nell'estremo più vicino al punto bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ; LuaSetParam( L, bOk) ; return 1 ; @@ -943,7 +943,7 @@ LuaCurveCompoSetTempProp( lua_State* L) int nPropInd = 0 ; LuaGetParam( L, 4, nPropInd) ; LuaClearStack( L) ; - // imposto sulla curva della composita la proprietą temporanea + // imposto sulla curva della composita la proprietĆ  temporanea bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ; LuaSetParam( L, bOk) ; return 1 ; @@ -973,16 +973,18 @@ LuaCurveCompoSetTempParam( lua_State* L) static int LuaChainCurvesInGroup( lua_State* L) { - // 2 o 3 parametri : nGroupId, ptNear [, nRefType] + // 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler] int nGroupId ; LuaCheckParam( L, 1, nGroupId) Point3d ptNear ; LuaCheckParam( L, 2, ptNear) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 3, nRefType) ; + double dToler = 10 * EPS_SMALL ; + LuaGetParam( L, 4, dToler) ; LuaClearStack( L) ; // concateno le curve nel gruppo (senza fonderle in una curva composita) - bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ; + bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ; LuaSetParam( L, bOk) ; return 1 ; } @@ -991,16 +993,18 @@ LuaChainCurvesInGroup( lua_State* L) static int LuaReorderCurvesInGroup( lua_State* L) { - // 2 o 3 parametri : nGroupId, ptNear [, nRefType] + // 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler] int nGroupId ; LuaCheckParam( L, 1, nGroupId) Point3d ptNear ; LuaCheckParam( L, 2, ptNear) int nRefType = RTY_DEFAULT ; LuaGetParam( L, 3, nRefType) ; + double dToler = 10 * EPS_SMALL ; + LuaGetParam( L, 4, dToler) ; LuaClearStack( L) ; // riordino le curve nel gruppo (senza fonderle in una curva composita) - bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ; + bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ; LuaSetParam( L, bOk) ; return 1 ; } @@ -1021,7 +1025,7 @@ LuaProjectCurveOnSurf( lua_State* L) if ( LuaGetParam( L, 4, dLinTol)) LuaGetParam( L, 5, dMaxSegmLen) ; LuaClearStack( L) ; - // proietto la curva su una o pił superfici a minima distanza + // proietto la curva su una o più superfici a minima distanza bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ; LuaSetParam( L, bOk) ; return 1 ; @@ -1051,7 +1055,7 @@ LuaProjectCurveOnSurfDir( lua_State* L) LuaGetParam( L, 8, bFromVsTo)) LuaGetParam( L, 9, nRefType) ; LuaClearStack( L) ; - // proietto la curva su una o pił superfici secondo la direzione data + // proietto la curva su una o più superfici secondo la direzione data bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ; LuaSetParam( L, bOk) ; return 1 ; @@ -1079,7 +1083,7 @@ LuaProjectCurveOnSurfExt( lua_State* L) LuaGetParam( L, 7, bDirFromGuide)) LuaGetParam( L, 8, bFromVsTo) ; LuaClearStack( L) ; - // proietto la curva su una o pił superfici secondo la direzione verso la guida + // proietto la curva su una o più superfici secondo la direzione verso la guida bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ; LuaSetParam( L, bOk) ; return 1 ;