From 45780fce291a9cc35ec8fbfa4c7a666b0a705b4e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 20 Oct 2025 14:34:03 +0200 Subject: [PATCH] =?UTF-8?q?-=20in=20LapJoint=20si=20gestisce=20il=20verso?= =?UTF-8?q?=20di=20lavorazione=20delle=20milling=20principali=20in=20conco?= =?UTF-8?q?rdanza.=20Pu=C3=B2=20diventare=20discordanza=20da=20flag=20macc?= =?UTF-8?q?hina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/WProcessLapJoint.lua | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 1b36a8f..cbc4541 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1373,9 +1373,11 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist) local dMillTotLen = 30 local dMaxDepth = 0 local dThDiam = 100 + local bIsToolCcw = false if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + bIsToolCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0 dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen @@ -1413,13 +1415,19 @@ local function MakeByMill( Proc, nFacet, nOthFac, nRawId, b3Raw, dSideDist) EgtSetMachiningParam( MCH_MP.ENDADDLEN, 0) -- -dMillDiam/2 + dAddLen) EgtSetMachiningParam( MCH_MP.LOTANG, 0) EgtSetMachiningParam( MCH_MP.LOPERP, dSideDist + WD.CUT_SIC) - -- setto inversione in base al workside - local bIsWorkSideRight = ( EgtGetMachiningParam( MCH_MP.WORKSIDE) == MCH_MILL_WS.RIGHT) - local bInvert = false - if bIsWorkSideRight then - bInvert = true + -- setto inversione e lato di lavoro + local bIsDominantX = abs( vtRef:getY()) > abs( vtRef:getX()) + 10 * GEO.EPS_SMALL + local bUseConventionalMilling = ( bIsDominantX and WD.USE_CONVENTIONAL_MILLING_ALONG_X) or WD.USE_CONVENTIONAL_MILLING_ALONG_Y + local bInvert, nWorkside + if bUseConventionalMilling then + bInvert = not bIsToolCcw + nWorkside = bIsToolCcw and MCH_MILL_WS.LEFT or MCH_MILL_WS.RIGHT + else + bInvert = bIsToolCcw + nWorkside = bIsToolCcw and MCH_MILL_WS.RIGHT or MCH_MILL_WS.LEFT end EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, nWorkside) -- imposto posizione braccio porta testa local nSCC = MCH_SCC.ADIR_ZP if AreSameOrOppositeVectorApprox( vtN, Z_AX()) then @@ -1509,9 +1517,11 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d local dMillDiamThStem = 0 local dMillLenTh = 0 local dSideStep = 0 + local bIsToolCcw = false if EgtMdbSetCurrMachining( sMilling) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + bIsToolCcw = EgtTdbGetCurrToolParam( MCH_TP.SPEED) < 0 dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMillLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dMillLen dMillTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dMillTotLen @@ -2052,9 +2062,19 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end -- scrivo le note della lavorazione EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) - -- setto il lato di lavoro standard - EgtSetMachiningParam( MCH_MP.INVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + -- setto lato di lavoro e inversione + local bIsDominantX = abs( vtN:getY()) > abs( vtN:getX()) + 10 * GEO.EPS_SMALL + local bUseConventionalMilling = ( bIsDominantX and WD.USE_CONVENTIONAL_MILLING_ALONG_X) or WD.USE_CONVENTIONAL_MILLING_ALONG_Y + local bInvert, nWorkside + if bUseConventionalMilling then + bInvert = bIsToolCcw + nWorkside = bIsToolCcw and MCH_MILL_WS.LEFT or MCH_MILL_WS.RIGHT + else + bInvert = not bIsToolCcw + nWorkside = bIsToolCcw and MCH_MILL_WS.RIGHT or MCH_MILL_WS.LEFT + end + EgtSetMachiningParam(MCH_MP.INVERT, bInvert) + EgtSetMachiningParam(MCH_MP.WORKSIDE, nWorkside) -- setto offset radiale per gestire le eventuali passate in orizzontale local dRadialOffset = dSideStep * ( nSideStep - i) EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset)