From 60e7f9040a233a62a30fe04f8529129235ae7fa3 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Fri, 22 May 2026 10:44:43 +0200 Subject: [PATCH] EgtExecutor : - aggiunto check per la scelta del lato a cui appliare l'interpolazione delle direzioni di lavorazione - corretta gestione delle direzioni rispetto al bordo scelto per l'operazione di interpolazione. --- EXE_Trimming.cpp | 13 ++++++++++--- Lua_Trimming.cpp | 22 ++++++++++++---------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/EXE_Trimming.cpp b/EXE_Trimming.cpp index d63a883..7688b52 100644 --- a/EXE_Trimming.cpp +++ b/EXE_Trimming.cpp @@ -874,7 +874,8 @@ ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, doubl // --------------------------------------------------------------------------- bool -ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEdgeId, bool bMainIsFirstBorder, int nSyncLayerId, int nLineSId, int nLineEId, +ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEdgeId, bool bMainIsFirstBorder, int nSyncLayerId, + int nLineSId, int nLineEId, bool bShorterSide, double dThetaStart, double dPhiStart, double dThetaEnd, double dPhiEnd, double dInterpLenS, double dInterpLenE, double dLinTol, int& nInterpStartId, int& nStartId, int& nEndId, int& nInterpEndId) @@ -890,7 +891,7 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ; const double TOL = dMyLinTol ; // Definisco costanti per interpolazione - const double INTERPOLATION_DIST = 0.5 ; // alzare + const double INTERPOLATION_DIST = 2 ; const double ISO_PAR_SAMPLE = 20.0 ; // Recupero il riferimento del gruppo di destinazione @@ -950,9 +951,11 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd double dLenE = 0., dLenMain = 0. ; bOk = ( pCompoMainCL->GetLengthAtPoint( Line2.first, dLenE, TOL) && pCompoMainCL->GetLength( dLenMain)) ; - if ( dLenE > dLenMain / 2. + EPS_SMALL) { + if ( dLenE > dLenMain / 2. + EPS_SMALL && bShorterSide) { swap( Line1, Line2) ; swap( pCrvSyncS, pCrvSyncE) ; + swap( dThetaStart, dThetaEnd) ; + swap( dPhiStart, dPhiEnd) ; } } } @@ -1063,6 +1066,8 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd pCompoIso->IsValid() && pCompoIso->GetStartPoint( LineInterpS.first) && pCompoIso->GetEndPoint( LineInterpS.second)) ; + if ( ! bMainIsFirstBorder) + swap( LineInterpS.first, LineInterpS.second) ; if ( bOk) { bool bFirst = true ; // Interpolo @@ -1179,6 +1184,8 @@ ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEd pCompoIso->IsValid() && pCompoIso->GetStartPoint( LineInterpE.first) && pCompoIso->GetEndPoint( LineInterpE.second)) ; + if ( ! bMainIsFirstBorder) + swap( LineInterpE.first, LineInterpE.second) ; if ( bOk) { // Interpolo double dLenLineInterpE = Dist( LineInterpE.first, LineInterpE.second) ; diff --git a/Lua_Trimming.cpp b/Lua_Trimming.cpp index a12aad1..dd60487 100644 --- a/Lua_Trimming.cpp +++ b/Lua_Trimming.cpp @@ -287,7 +287,7 @@ LuaTrimmingGetSurfBzSyncPoints( lua_State* L) static int LuaTrimmingGetToolOrientationLines( lua_State* L) { - // 14 parametri : nParentId, nMainEdgeId, nOtherEdgeId, bMainIsFirstBorder, nSyncLayerId, nLineSId, nLineEId, + // 15 parametri : nParentId, nMainEdgeId, nOtherEdgeId, bMainIsFirstBorder, nSyncLayerId, nLineSId, nLineEId, bShorterSide // dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol int nParentId ; LuaCheckParam( L, 1, nParentId) @@ -301,26 +301,28 @@ LuaTrimmingGetToolOrientationLines( lua_State* L) LuaCheckParam( L, 5, nLineSId) int nLineEId ; LuaCheckParam( L, 6, nLineEId) + bool bShorterSide ; + LuaCheckParam( L, 7, bShorterSide) int nSyncLayerId ; - LuaCheckParam( L, 7, nSyncLayerId) + LuaCheckParam( L, 8, nSyncLayerId) double dThetaStart ; - LuaCheckParam( L, 8, dThetaStart) + LuaCheckParam( L, 9, dThetaStart) double dPhiStart ; - LuaCheckParam( L, 9, dPhiStart) + LuaCheckParam( L, 10, dPhiStart) double dThetaEnd ; - LuaCheckParam( L, 10, dThetaEnd) + LuaCheckParam( L, 11, dThetaEnd) double dPhiEnd ; - LuaCheckParam( L, 11, dPhiEnd) ; + LuaCheckParam( L, 12, dPhiEnd) ; double dInterpLenS ; - LuaCheckParam( L, 12, dInterpLenS) + LuaCheckParam( L, 13, dInterpLenS) double dInterpLenE ; - LuaCheckParam( L, 13, dInterpLenE) + LuaCheckParam( L, 14, dInterpLenE) double dLinTol ; - LuaCheckParam( L, 14, dLinTol) + LuaCheckParam( L, 15, dLinTol) LuaClearStack( L) ; // Inserisco i tratti lineari associati calcolati lungo il percorso int nInterpStartId = GDB_ID_NULL, nStartId = GDB_ID_NULL, nEndId = GDB_ID_NULL, nInterpEndId = GDB_ID_NULL ; - bool bOk = ExeTrimmingGetToolOrientationLines( nParentId, nMainEdgeId, nOtherEdgeId, bMainIsFirstBorder, nSyncLayerId, nLineSId, nLineEId, + bool bOk = ExeTrimmingGetToolOrientationLines( nParentId, nMainEdgeId, nOtherEdgeId, bMainIsFirstBorder, nSyncLayerId, nLineSId, nLineEId, bShorterSide, dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol, nInterpStartId, nStartId, nEndId, nInterpEndId) ; LuaSetParam( L, bOk) ;