From 40912bb7b75c9dcb1d72e022b8ad8021ee0ce6a8 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 25 Feb 2025 08:54:16 +0100 Subject: [PATCH] In FbS, per TURN, se taglio con bilinea che forma un angolo ottuso, invece di fare retrazione (in alcuni casi non completa il taglio) si segue bilinea per il tratto che manca per completare taglio e poi si esce perpendicolarmente. --- LuaLibs/FacesBySaw.lua | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index ef952a6..2aa124b 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -373,6 +373,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp) local dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp) local dLiCompLength = 0 + local dLoCompLength = 0 -- attacco tangente local dLi2Tang = 0 local dLi2Perp = 0 @@ -394,6 +395,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw end local dLenLi2 = abs( dLi2Tang) local dLenLo2 = abs( dLo2Tang) + local dBiLineaAddLength = 0 -- se il lato non lavorato della bilinea è aperto, setto entrata/uscita con la stessa direzione if bIsBiLinea then @@ -422,8 +424,9 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local dDistPointToCenter = sqrt( dDistPtTang * dDistPtTang + dDistToCenter * dDistToCenter) -- se distanza al punto è maggiore del raggio lama, significa che non ho già lavorato, quindi calcolo uscita opportunamente if dDistPointToCenter > 0.5 * dSawDiam then + dBiLineaAddLength = dDistPointToCenter - ( 0.5 * dSawDiam) dLoTang = -dAllEnd * dCosAlpha - dLoPerp = dDist2 * dSinAlpha + dLoPerp = dDist2 * dSinAlpha end end end @@ -455,11 +458,23 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- dLoPerp rimane invariato end elseif BD.TURN then - bLioTang = 2 - local dMove = dist( ptP1, ptP2) dLiTang, dLiPerp = dLi2Tang, dLi2Perp - dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove) - dLoPerp = BD.COLL_SIC + -- se angolo bilinea ottuso si segue bilinea per un tratto per tagliare completamente cubetto a forma di rombo + if dCosAngleL1L2 > 0.707 and bIsBiLinea then + -- calcolo uscita per prolungare solo della parte mancante per completare il taglio + if dBiLineaAddLength > 0 then + dLoTang = dLoTang * ( dBiLineaAddLength + BD.COLL_SIC) / 100 + dLoPerp = dLoPerp * ( dBiLineaAddLength + BD.COLL_SIC) / 100 + end + -- aggiungo componente perpendicolare a percorso per ritornare dal punto di ingresso, altrimenti l'uscita viene allungata fino dall'altra parte del grezzo + dLoCompLength = 100 + -- se angolo bilinea oltre 45°, faccio movimento in retrazione + else + bLioTang = 2 + local dMove = dist( ptP1, ptP2) + dLoTang = -( dLiTang - dAccStart - dAccEnd + dMove) + dLoPerp = BD.COLL_SIC + end else bLioTang = true dLiTang, dLiPerp, dLoTang, dLoPerp, dLiCompLength = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp, dLi2CompLength @@ -551,6 +566,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if BD.TURN and bLioTang == 2 then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) + EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength) -- imposto allungamenti iniziale e finale EgtSetMachiningParam( MCH_MP.STARTADDLEN, dAllStart - dAccStart) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dAllEnd - dAccEnd)