From 5ff950015eaf19487db521382ab0280e948cd538 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 4 Aug 2023 18:57:04 +0200 Subject: [PATCH] - a WallExec aggiunta rimozione operazioni se legate a lavorazioni specchiate - modifiche varie per forzare sideGroove in caso la lavorazione principale sia una tasca cieca che guarda in alto - modificata MakeMoreFaces per contemplare lavorazioni in doppio --- LuaLibs/WProcessLapJoint.lua | 55 +++++++++++++++++++++++------------- LuaLibs/WallExec.lua | 42 +++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 1486626..e231d07 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -2212,30 +2212,23 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) dDiam = min( dDiam, WD.MAXDIAM_POCK_CORNER or 1000) end -- recupero la lavorazione + local bUseDElevToFindPocketing = true local sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev) if not sPocketing then + bUseDElevToFindPocketing = false sPocketing = WM.FindPocketing( 'Pocket', dDiam) - if Proc.Double and Proc.Double == 2 then - local sPocketingBackup = sPocketing - sPocketing = WM.FindPocketing( 'Pocket', dDiam, nil, nil, 'H1') - if not IsMachiningOkForDouble( sPocketing) then - Proc.Double = 0 - sPocketing = sPocketingBackup - end - end if not sPocketing then local sErr = 'Error : pocketing not found in library' EgtOutLog( sErr) return false, sErr end - else - if Proc.Double and Proc.Double == 2 then - local sPocketingBackup = sPocketing - sPocketing = WM.FindPocketing( 'Pocket', dDiam, dElev, nil, 'H1') - if not IsMachiningOkForDouble( sPocketing) then - Proc.Double = 0 - sPocketing = sPocketingBackup - end + end + if Proc.Double and Proc.Double == 2 then + local sPocketingBackup = sPocketing + sPocketing = WM.FindPocketing( 'Pocket', dDiam, EgtIf( bUseDElevToFindPocketing, dElev, nil), nil, 'H1') + if not IsMachiningOkForDouble( sPocketing) then + Proc.Double = 0 + sPocketing = sPocketingBackup end end -- recupero i dati dell'utensile @@ -2681,6 +2674,17 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) local dSideElev = WL.GetFaceElevation( Proc.Id, nFacInd) -- se abilitata lavorazione ribasso con fresa di fianco e parametro Q03 abilitato local sMillOnSide, dTMaxDepth, dMaxMat, dDiam = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev) + -- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata + local bDoubleMillOnSide = false + if Proc.Double and Proc.Double == 2 then + local sMillOnSideBackup = sMillOnSide + sMillOnSide = WM.FindMilling( 'SideMill', nil, nil, nil, nil, min( dH, dV), nil, dSideElev, 'H1') + if IsMachiningOkForDouble( sMillOnSide) then + bDoubleMillOnSide = true + else + sMillOnSide = sMillOnSideBackup + end + end local _, nUseMillOnSide = EvaluateQParam( Proc) -- se ho abilitata lavorazione di fresa di fianco if Proc.Fct >= 3 and sMillOnSide and nUseMillOnSide >= 1 and not bIsSmallSlot then @@ -2721,14 +2725,27 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) nSinglePass = 2 bMakeFirstGroove = false end - return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass) + return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, EgtIf( dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, nil, nil, bLikeAsMakeFirstGroove, nSinglePass, nil, bDoubleMillOnSide) end else -- fresatura (se definita); se disponibile, cerco di usare un utensile che non lavori al limite della capacità di sottosquadro - local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, 1.2 * dSideElev) + local dSideElevMultiplier = 1.2 + local sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElevMultiplier * dSideElev) -- se non ho trovato un utensile un po' più grande del sottosquadro richiesto, passo alla ricerca standard if not sMilling then sMilling = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElev) + dSideElevMultiplier = 1 + end + -- se Proc è settata per essere specchiata cerco la lavorazione adatta e verifico possa essere effettivamente specchiata + bDoubleMillOnSide = false + if Proc.Double and Proc.Double == 2 then + local sMillOnSideBackup = sMillOnSide + sMillOnSide = WM.FindMilling( 'SideGroove', nil, nil, nil, nil, min( dH, dV), nil, dSideElevMultiplier * dSideElev, 'H1') + if IsMachiningOkForDouble( sMillOnSide) then + bDoubleMillOnSide = true + else + sMillOnSide = sMillOnSideBackup + end end -- recupero i dati dell'utensile local dMaxMat = 1000 @@ -2753,7 +2770,7 @@ local function MakeMoreFaces( Proc, nRawId, b3Raw) end end if sMilling and dElev < dMaxDepthOnSide then - return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling) + return MakeSideGrooveByMill( Proc, nFacInd, nRawId, b3Raw, sMilling, nil, nil, nil, nil, nil, nil, nil, bDoubleMillOnSide) -- altrimenti sega a catena else return MakeByChainSaw( Proc, nFacInd, nRawId, b3Raw, dElev, dH, dV) diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 20713a8..f3ca414 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -673,6 +673,7 @@ local function SetMirroredFeatures( vProc, b3Raw) local nMirrorId local dYMirrorAx local dDeltaZ + local bIsMirrorTowardsBottom = false for j = 1, #vProc do local ProcMirror = vProc[j] if ProcMirror.TopologyLongName == Proc.TopologyLongName and ProcMirror.Id ~= Proc.Id and ProcMirror.Flg ~= 0 then @@ -709,6 +710,7 @@ local function SetMirroredFeatures( vProc, b3Raw) local ptOnMirrorAx = ( Proc.Box:getCenter() + ProcMirror.Box:getCenter()) / 2 dYMirrorAx = ptOnMirrorAx:getY() - b3Tab:getMin():getY() dDeltaZ = ProcMirror.Box:getMax():getZ() - Proc.Box:getMax():getZ() + bIsMirrorTowardsBottom = ProcMirror.AffectedFaces.Bottom end end end @@ -721,6 +723,11 @@ local function SetMirroredFeatures( vProc, b3Raw) Proc.MirrorAx = dYMirrorAx -- Offset Z tra le feature Proc.MirrorDeltaZ = dDeltaZ + -- se sono groove cieche e la principale guarda su e l'altra guarda giù, la principale va trattata come sidegroove in accordo con la seconda + if ( Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-3' or Proc.TopologyLongName == 'Groove-Blind-RightAngles-Parallel-4') and + Proc.AffectedFaces.Top and bIsMirrorTowardsBottom then + Proc.Stype = 2 + end end end @@ -783,7 +790,7 @@ function WallExec.ProcessFeatures() else table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) end - elseif not Proc.Double then + elseif not Proc.Double then local sMsg = 'Feature not machinable by orientation' table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId}) end @@ -795,7 +802,38 @@ function WallExec.ProcessFeatures() -- ELIMINAZIONE LAVORAZIONI MIRROR IN BASE A SETTAGGIO MACHININGTODELETE IN PROC -- 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 + local Proc = vProc[i] + if Proc.Double and Proc.Double > 0 then + for j = 1, #vProc do + local ProcMirror = vProc[j] + if Proc.MirrorId == ProcMirror.Id then + table.insert( vProcToDisable, ProcMirror.Id) + end + end + end + end + -- cancello le operazioni legate a lavorazioni specchiate + local nOperId = EgtGetNextOperation( EgtGetPhaseDisposition( 1)) + while nOperId do + EgtSetCurrMachining( nOperId) + local nOperationProcIds = EgtGetMachiningGeometry() + local nOperationProcId = EgtIf( #nOperationProcIds[1] > 1, nOperationProcIds[1][1], nOperationProcIds[1]) + local nCurrentOperId = nOperId + for i = 1, #vProcToDisable do + local ProcId = vProcToDisable[i] + if nOperationProcId == ProcId then + nOperId = EgtGetNextOperation( nOperId) + EgtRemoveOperation(nCurrentOperId) + break + end + end + if nCurrentOperId == nOperId then + nOperId = EgtGetNextOperation( nOperId) + end + end -- se macchina pareti if not WD.BEAM_MACHINE then -- riordino le lavorazioni tra tutti i pezzi