From 4500f96d6dc02276ecae36ca9166531811356c9b Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 17 Jan 2025 16:33:28 +0100 Subject: [PATCH] Aggiunto parametro Q09 per inversione ultimo passaggio su contorno libero --- LuaLibs/ProcessFreeContour.lua | 56 +++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index 87d91bd..c7f00ca 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -33,6 +33,7 @@ local Q_ONLY_CHAMFER = 'Q00' -- i local Q_RADIAL_OFFSET = 'Q06' -- d, valido solo per pocket local Q_IGNORE_LASER_PROBLEMS = 'Q07' local Q_FORCE_CLAMPABLE_AREA = 'Q08' +local Q_INVERT_LAST_PATH = 'Q09' --------------------------------------------------------------------- -- Riconoscimento della feature @@ -588,6 +589,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) end end end + -- eventuale inversione ultimo segmento + local bInvertLastPath = ( ( EgtGetInfo( Proc.Id, Q_INVERT_LAST_PATH, 'd') or 0) == 1) -- eseguo for i = 1, nStep do for j = 1, nDouble do @@ -630,35 +633,66 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) -- aggiungo geometria EgtSetMachiningGeometry( {{ AuxId, -1}}) -- eventuale accorciamento di testa + local dStartAddLen, dEndAddLen, dWorkSide, bToolInvert, bInvert if ( j == 1 and i > 1) or ( j == 2 and i < nStep) then - local dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep) - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) + dStartAddLen = EgtIf( j == 1, - ( i - 1) * dStep, - ( nStep - i) * dStep) else - EgtSetMachiningParam( MCH_MP.STARTADDLEN, EgtIf( j == 1, dStartAddSpec, dEndAddSpec)) + dStartAddLen = EgtIf( j == 1, dStartAddSpec, dEndAddSpec) end -- eventuale accorciamento di coda if ( j == 1 and i < nStep) or ( j == 2 and i > 1) then - local dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) + dEndAddLen = EgtIf( j == 1, - ( nStep - i) * dStep, - ( i - 1) * dStep) else - EgtSetMachiningParam( MCH_MP.ENDADDLEN, EgtIf( j == 1, dEndAddSpec, dStartAddSpec)) + dEndAddLen = EgtIf( j == 1, dEndAddSpec, dStartAddSpec) end -- se estrusione da sotto, inverto direzione fresa if ( j == 1 and bToolInv) or ( j == 2 and not bToolInv) then - EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + bToolInvert = true + else + bToolInvert = false end -- se seconda passata, inverto direzione di lavoro if j == 2 then - EgtSetMachiningParam( MCH_MP.INVERT, true) + bInvert = true + else + bInvert = false end + -- assegno lato di lavoro if Proc.Grp == 0 then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.CENTER) + dWorkSide = MCH_MILL_WS.CENTER elseif ( Proc.Grp == 3 and not bToolInv) or ( Proc.Grp == 4 and bToolInv) or ( Proc.Grp == 1 and bToolInv) or ( Proc.Grp == 2 and bToolInv) then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + dWorkSide = MCH_MILL_WS.LEFT elseif ( Proc.Grp == 3 and bToolInv) or ( Proc.Grp == 4 and not bToolInv) or ( Proc.Grp == 1 and not bToolInv) or ( Proc.Grp == 2 and not bToolInv) then - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + dWorkSide = MCH_MILL_WS.RIGHT end + + -- se ultimo step da invertire + if i == nStep and bInvertLastPath then + -- se profilo orizzontale + if abs( vtExtr:getZ()) < 10 * GEO.EPS_SMALL then + dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen + bInvert = not( bInvert) + bToolInvert = not( bToolInvert) + else + dStartAddLen, dEndAddLen = dEndAddLen, dStartAddLen + bInvert = not( bInvert) + if dWorkSide == MCH_MILL_WS.LEFT then + dWorkSide = MCH_MILL_WS.RIGHT + elseif dWorkSide == MCH_MILL_WS.RIGHT then + dWorkSide = MCH_MILL_WS.LEFT + end + end + end + + -- setto i valori + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToolInvert) + EgtSetMachiningParam( MCH_MP.INVERT, bInvert) + EgtSetMachiningParam( MCH_MP.WORKSIDE, dWorkSide) + + -- posizione braccio porta testa local nSCC = MCH_SCC.NONE if not BD.C_SIMM then