From da7d2a71598eaf824bbef9a0841bc16a0863c12e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 13 Nov 2023 18:18:48 +0100 Subject: [PATCH] - in WallExec aggiunte al sorting le lavorazioni PreSideMill che vengono sempre fatte prima delle SideMill - LapJoint -> MakeSideGrooveByMill, se rabbet doppio uno verso l'alto e uno verso il basso, aggiunto step extra iniziale per ripulire la lamina che potrebbe rimanere nella rabbet che guarda in alto. --- LuaLibs/WProcessLapJoint.lua | 86 ++++++++++++++++++++++++++++++++++-- LuaLibs/WallExec.lua | 12 ++--- 2 files changed, 88 insertions(+), 10 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index fa463d4..818e21c 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -36,6 +36,8 @@ -- 2023/11/07 In MakeByPocketing, se tasca che guarda davanti, aggiunta possibilità di attaccare fuori dal grezzo fino ad uno spessore di 75 mm. -- In MakeByPocketing calcolo del massimo diametro utensile spostato in VerifyPocketing. -- In MakeByPocketing il doppio viene ora disattivato se una tasca deve essere forzata chiusa e l'altra no. +-- 2023/11/13 In MakeSideGrooveByMill, se rabbet doppio uno verso l'alto e uno verso il basso, aggiunto step extra iniziale per ripulire la lamina che potrebbe rimanere nella rabbet che guarda in alto. + -- Tabella per definizione modulo local WPL = {} @@ -1521,10 +1523,14 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end end -- se profondità ribasso è maggiore della capacità di sottosquadro dell'utensile - if ( not bEnablePreMill and ( bMachFromDn or Proc.Fct > 2)) and ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then - local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')' - EgtOutLog( sErr) - return false, sErr + if ( dElev > 0.5 * ( dMillDiam - dMillDiamTh) - 10 * GEO.EPS_SMALL) then + if ( not bEnablePreMill and ( bMachFromDn or Proc.Fct > 2)) then + local sErr = 'Error : Side Elevation (' .. dElev .. ') bigger than max tool side depth (' .. ( 0.5 * ( dMillDiam - dMillDiamTh)) ..')' + EgtOutLog( sErr) + return false, sErr + elseif Proc.Double then + Proc.Double = 0 + end end local dMillExtra = dMillTotLen - dMillLen if Proc.Box:getMin():getZ() - dMillExtra < b3Raw:getMin():getZ() - 10 * GEO.EPS_SMALL then @@ -1895,6 +1901,78 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d bUpwardMilling = true end + -- step extra in caso di doppio con mix rabbet dal basso e dall'alto, per eliminare la lamina che potrebbe rimanere + if Proc.Double and Proc.Double == 2 and Proc.Topology == 'Rabbet' and + not ( Proc.AffectedFaces.Bottom and Proc.Mirror.AffectedFaces.Bottom) and not ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) then + -- determino a quale delle due feature applicare la lavorazione + local bProcVsMirrorToCopy = true + local nFacetToMachine = nFacet + if Proc.AffectedFaces.Bottom then + bProcVsMirrorToCopy = false + for i = 1, Proc.Mirror.Fct do + local vtNMirror = Proc.Mirror.Face[i].VtN + if AreOppositeVectorApprox( vtN, vtNMirror) then + nFacetToMachine = Proc.Mirror.Face[i].Id + break + end + end + end + local nAddGrpId = WL.GetAddGroup( EgtIf( bProcVsMirrorToCopy, Proc.PartId, Proc.Mirror.PartId)) + local nNewProc = EgtCopyGlob( EgtIf( bProcVsMirrorToCopy, Proc.Id, Proc.Mirror.Id), nAddGrpId) or GDB_ID.NULL + local NewProc = { Id = nNewProc, PartId = EgtIf( bProcVsMirrorToCopy, Proc.PartId, Proc.Mirror.PartId)} + -- lavorazione + local sName = 'PreSideMill_' .. EgtGetName( NewProc.Id) or tostring( NewProc.Id) + local nMchFId = WM.AddMachining( NewProc, sName, sMilling) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling + EgtOutLog( sErr) + return false, sErr + end + EgtSetInfo( nMchFId, 'Part', NewProc.PartId) + -- aggiungo geometria + EgtSetMachiningGeometry( {{ NewProc.Id, nFacetToMachine}}) + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.ADIR_NEAR + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + -- imposto modo di lavorare la faccia + local nFaceUse = WL.GetNearestParalOpposite( Z_AX()) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + -- imposto elevazione e step + local dDepth = 5 + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + EgtSetMachiningParam( MCH_MP.STEP, dElev) + -- setto il lato di lavoro standard + EgtSetMachiningParam( MCH_MP.INVERT, true) + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + -- setto allungamenti iniziali e finali + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dExtraLongIni) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dExtraLongEnd) + -- Confronto il raggio fresa con l'elevazione dalla normale per vedere se devo modificare l'uscita + if dElev > ( 0.5 * dMillDiam) then + -- setto allungamenti perpendicolari + EgtSetMachiningParam( MCH_MP.LIPERP, 0) + EgtSetMachiningParam( MCH_MP.LOPERP, 0) + end + -- se richiesto, setto la nota per spostare la lavorazione alla fine + if not WD.SIDEMILL_BEFORE then + EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) + end + -- eseguo + if not EgtApplyMachining( true, false) then + -- provo a invertire posizione braccio porta testa + nSCC = MCH_SCC.ADIR_FAR + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + if not EgtApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + end + -- se faccio lo step extra e ho rimosso la lamina, in doppio lavorerò dal basso verso l'alto + bUpwardMilling = true + end + + -- lavorazione local dStepOri if not bExcludeSideMill then local nSideStep = 1 diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 231ead8..ffae5ae 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -6,6 +6,7 @@ -- 2023/07/04 Se c'è funzione di macchina WD.GetOrigCorner si lascia scegliere posizione default a questa impostando 0 se non c'è 'REFPOS'. -- 2023/10/16 Aggiunta gestione Aree vietate (LockOut) per chiodature. -- 2023/11/10 In SetMirroredFeatures doppio disattivato se side e la lavorazione mirror è troppo distante dal grezzo. +-- 2023/11/13 Aggiunte le lavorazioni PreSideMill che vengono sempre fatte prima delle SideMill. -- Tabella per definizione modulo local WallExec = {} @@ -608,6 +609,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority) PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false, nil, nil, nil, nPriority) -- Fresature per gole PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Gorge_'}, true, 'MOVE_AFTER', false, nil, nil, nil, nPriority) + -- Fresature da fare prima delle SideMill + PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'PreSideMill_'}, true, 'MOVE_AFTER', false, false, true, true, nPriority) -- Fresature che sono rifiniture di spigoli PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', false, false, true, true, nPriority) -- Fresature che sono puliture di spigoli @@ -618,6 +621,8 @@ local function SortMachinings( nPhase, PrevMch, nPartId, nPriority) PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING, nil, nil, nil, nil, nil, nil, nil, nPriority) -- Qui rimozione sfridi (se ci sono lavorazioni successive) if not nPriority then + -- Fresature da fare prima delle SideMill + PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'PreSideMill_'}, true, 'MOVE_AFTER', true, false, true, true) -- Fresature dei lapjoint che necessitano di gorge PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', true, false, true, true) -- Tagli con sega a catena che vanno fatti dopo i tagli con lama @@ -783,7 +788,7 @@ local function SetMirroredFeatures( vProc, b3Raw) -- se di fianco, si sceglie se le feature sono compatibili con il doppio e nel caso che tipo di lavorazione fare -- -1: no doppio, 0: nessuna preferenza, 1: pocket, 2: side (scambio faccia principale) local nDoubleType = 0 - local bAllowSideOnMirror = ( ProcMirror.DistanceToRawPart.Back - Proc.DistanceToRawPart.Front < 1 + 10 * GEO.EPS_SMALL) + local bAllowSideOnMirror = ( ProcMirror.DistanceToRawPart.Back - Proc.DistanceToRawPart.Front < 1 + 10 * GEO.EPS_SMALL) or ( not WD.SIDEMILL_BEFORE and ( not Proc.AffectedFaces.Top or not ProcMirror.AffectedFaces.Top)) if bLapVsTop and ( Proc.AffectedFaces.Top or Proc.AffectedFaces.Bottom) then -- side if bIsFeatureOnEdge and bIsMirrorFeatureOnEdge then @@ -1119,11 +1124,6 @@ function WallExec.ProcessFeatures() end EgtOutLog( ' *** End AddMachinings ***', 1) - ------- - -- LAVORAZIONI IN DOPPIO - QUI INSERIRE: - -- VERIFICA E UPDATE NOTE PER LAVORAZIONI IN CUI SI CONTROLLA SE I PERCORSI SONO SPECCHIATI - ------- - -- setto quali sono le lavorazioni da disattivare perchè specchiate di lavorazioni in doppio local vProcToDisable = {} for i = 1, #vProc do