From bde8e81240bd31bc2352aff6c6a2a2b7f9c1abec Mon Sep 17 00:00:00 2001 From: "luca.bacis" Date: Tue, 14 Dec 2021 12:03:14 +0100 Subject: [PATCH] - lettura parametri Q solo all'inizio --- LuaLibs/BeamExec.lua | 2 +- LuaLibs/ProcessLapJoint.lua | 155 ++++++++++++++++++------------------ 2 files changed, 80 insertions(+), 77 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 63d1bcc..f4e406e 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -393,7 +393,7 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH) Proc2.Fct = Proc.Fct Proc2.Diam = Proc.Diam Proc2.Head = Drill.IsHeadFeature( Proc2, b3Raw, dCurrOvmH) - Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw, dCurrOvmH) + Proc2.Tail = Drill.IsTailFeature( Proc2, b3Raw) Proc2.Fcs = Proc.Fce Proc2.Fce = Proc.Fcs Proc2.CutId = Proc.CutId diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 9caa03f..03749cf 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -52,19 +52,20 @@ local BD = require( 'BeamData') local ML = require( 'MachiningLib') -- variabili assegnazione parametri Q -local Q_FORCE_BLADE = '' -- i -local Q_DEPTH_CHAMFER = '' -- d -local Q_ONLY_CHAMFER = '' -- i -local Q_USE_MILL = '' -- i -local Q_USE_ROUGH_TOOL = '' -- i -local Q_USE_ROUGH_TOOL_B90 = '' -- i -local Q_USE_ROUGH_TOOL_B0 = '' -- i -local Q_BORE_ON_CORNER = '' -- 1 -local Q_CONTOUR_SMALL_TOOL = '' -- i -local Q_ONLY_CONTOUR = '' -- i -local Q_SIDE_ROUGH_TOOL = '' -- i -local Q_ANTISPLINT_TYPE = '' -- i -local Q_BLADE_ON_ALONG_FACE = '' -- i +local Q_FORCE_BLADE = nil -- i +local Q_DEPTH_CHAMFER = 0.0 -- d +local Q_MAX_ELEVATION = 0.0 -- d +local Q_ONLY_CHAMFER = 0 -- i +local Q_USE_MILL = 0 -- i +local Q_USE_ROUGH_TOOL = 0 -- i +local Q_USE_ROUGH_TOOL_B90 = 0 -- i +local Q_USE_ROUGH_TOOL_B0 = 0 -- i +local Q_BORE_ON_CORNER = 0 -- i +local Q_CONTOUR_SMALL_TOOL = 0 -- i +local Q_ONLY_CONTOUR = 0 -- i +local Q_SIDE_ROUGH_TOOL = 0 -- i +local Q_ANTISPLINT_TYPE = 0 -- i +local Q_BLADE_ON_ALONG_FACE = 0 -- i -- variabile smussi local bMadeChamfer @@ -92,63 +93,65 @@ end local function AssignQIdent( Proc) -- reset assegnazione parametri Q - Q_FORCE_BLADE = '' - Q_DEPTH_CHAMFER = '' - Q_ONLY_CHAMFER = '' - Q_USE_MILL = '' - Q_USE_ROUGH_TOOL = '' - Q_USE_ROUGH_TOOL_B90 = '' - Q_USE_ROUGH_TOOL_B0 = '' - Q_BORE_ON_CORNER = '' - Q_CONTOUR_SMALL_TOOL = '' - Q_ONLY_CONTOUR = '' - Q_SIDE_ROUGH_TOOL = '' - Q_ANTISPLINT_TYPE = '' + Q_FORCE_BLADE = nil + Q_BLADE_ON_ALONG_FACE = 0 + Q_DEPTH_CHAMFER = 0.0 + Q_ONLY_CHAMFER = 0 + Q_USE_MILL = 0 + Q_USE_ROUGH_TOOL = 0 + Q_USE_ROUGH_TOOL_B90 = 0 + Q_USE_ROUGH_TOOL_B0 = 0 + Q_BORE_ON_CORNER = 0 + Q_CONTOUR_SMALL_TOOL = 0 + Q_ONLY_CONTOUR = 0 + Q_SIDE_ROUGH_TOOL = 0 + Q_ANTISPLINT_TYPE = 0 + Q_MAX_ELEVATION = EgtGetInfo( Proc.Id, 'Q10', 'd') or 0.0 if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then - Q_FORCE_BLADE = 'Q01' -- i - Q_DEPTH_CHAMFER = 'Q04' -- d - Q_ONLY_CHAMFER = 'Q05' -- i + Q_FORCE_BLADE = EgtGetInfo( Proc.Id, 'Q01', 'i') -- can be nil + Q_DEPTH_CHAMFER = EgtGetInfo( Proc.Id, 'Q04', 'd') or 0.0 + Q_ONLY_CHAMFER = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 17 then - Q_DEPTH_CHAMFER = 'Q01' -- d - Q_ONLY_CHAMFER = 'Q02' -- i + Q_DEPTH_CHAMFER = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0.0 + Q_ONLY_CHAMFER = EgtGetInfo( Proc.Id, 'Q02', 'i') or 0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 20 then - Q_DEPTH_CHAMFER = 'Q01' -- d - Q_USE_MILL = 'Q02' -- i - Q_USE_ROUGH_TOOL = 'Q03' -- i - Q_USE_ROUGH_TOOL_B90 = 'Q04' -- i - Q_USE_ROUGH_TOOL_B0 = 'Q05' -- i - Q_BORE_ON_CORNER = 'Q06' -- i + Q_DEPTH_CHAMFER = EgtGetInfo( Proc.Id, 'Q01', 'd') or 0.0 + Q_USE_MILL = EgtGetInfo( Proc.Id, 'Q02', 'i') or 0 + Q_USE_ROUGH_TOOL = EgtGetInfo( Proc.Id, 'Q03', 'i') or 0 + Q_USE_ROUGH_TOOL_B90 = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0 + Q_USE_ROUGH_TOOL_B0 = EgtGetInfo( Proc.Id, 'Q05', 'i') or 0 + Q_BORE_ON_CORNER = EgtGetInfo( Proc.Id, 'Q06', 'i') or 0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 25 then - Q_BORE_ON_CORNER = 'Q01' -- i + Q_BORE_ON_CORNER = EgtGetInfo( Proc.Id, 'Q01', 'i') or 0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 30 then - Q_CONTOUR_SMALL_TOOL = 'Q01' -- i - Q_ONLY_CONTOUR = 'Q02' -- i - Q_SIDE_ROUGH_TOOL = 'Q03' -- i - Q_BLADE_ON_ALONG_FACE = 'Q04' -- i - Q_ANTISPLINT_TYPE = 'Q06' -- i - Q_DEPTH_CHAMFER = 'Q07' -- d + Q_CONTOUR_SMALL_TOOL = EgtGetInfo( Proc.Id, 'Q01', 'i') or 0 + Q_ONLY_CONTOUR = EgtGetInfo( Proc.Id, 'Q02', 'i') or 0 + Q_SIDE_ROUGH_TOOL = EgtGetInfo( Proc.Id, 'Q03', 'i') or 0 + Q_BLADE_ON_ALONG_FACE = EgtGetInfo( Proc.Id, 'Q04', 'i') or 0 + Q_ANTISPLINT_TYPE = EgtGetInfo( Proc.Id, 'Q06', 'i') or 0 + Q_DEPTH_CHAMFER = EgtGetInfo( Proc.Id, 'Q07', 'd') or 0.0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then - Q_SIDE_ROUGH_TOOL = 'Q01' -- i - Q_CONTOUR_SMALL_TOOL = 'Q02' -- i - Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_SIDE_ROUGH_TOOL = EgtGetInfo( Proc.Id, 'Q01', 'i') or 0 + Q_CONTOUR_SMALL_TOOL = EgtGetInfo( Proc.Id, 'Q02', 'i') or 0 + Q_ANTISPLINT_TYPE = EgtGetInfo( Proc.Id, 'Q06', 'i') or 0 elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 34 then - Q_CONTOUR_SMALL_TOOL = 'Q01' -- i - Q_ANTISPLINT_TYPE = 'Q06' -- i + Q_CONTOUR_SMALL_TOOL = EgtGetInfo( Proc.Id, 'Q01', 'i') or 0 + Q_ANTISPLINT_TYPE = EgtGetInfo( Proc.Id, 'Q06', 'i') or 0 end - -- le altre features gestite non hanno parametri Q + end --------------------------------------------------------------------- local function EvaluateQParam( Proc) -- verifico che lo smusso sia richiesto local nChamfer = 0 - local dDepth = EgtGetInfo( Proc.Id, Q_DEPTH_CHAMFER, 'd') or 0 + local dDepth = Q_DEPTH_CHAMFER if dDepth > 0 then nChamfer = 1 end -- verifico se posso fare solo lo smusso - if EgtGetInfo( Proc.Id, Q_ONLY_CHAMFER, 'i') == 1 then + if Q_ONLY_CHAMFER == 1 then if dDepth > 0 then nChamfer = nChamfer + 1 -- altrimenti se non ho l'affondamento esco @@ -165,7 +168,7 @@ local function EvaluateQParam( Proc) -- implementare un ulteriore parametro per poter scegliere di prediligere la sega-catena o no al fine di continuare -- a cambiare il codice per gestire il caso particolare local bForceUseBlade = false - if #Q_FORCE_BLADE == 0 or EgtGetInfo( Proc.Id, Q_FORCE_BLADE, 'i') == 1 then + if Q_FORCE_BLADE == nil or Q_FORCE_BLADE == 1 then bForceUseBlade = true end @@ -353,7 +356,7 @@ local function VerifyBHSideMill( Proc, bMasterIsU, bMasterIsL, bSinglePart, bPre -- si elude il controllo del Q solo se la variabile del Beamdata BD.BH_MACHINE segnala che non è una macchina tipo BH (ha la fresa blockhaus al posto della lama) -- se non feature BlockHausHalfLap o non abilitato parametro Q per lavorarlo di fianco esco - local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 + local nUseSideTool = Q_SIDE_ROUGH_TOOL if Proc.Prc ~= 37 and nUseSideTool == 0 and not BD.BH_MACHINE then return false end @@ -876,7 +879,7 @@ local function MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHead) -- verifico il numero di facce della tacca assert( ( Proc.Fct == 2), 'Error : MakeTwoFacesByMill in LapJoint with ' .. tostring( Proc.Fct) .. ' faces') -- recupero il parametro Q per uso fresa - local nUseRM = EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') + local nUseRM = Q_USE_MILL -- recupero la lavorazione local sMilling if nUseRM and nUseRM == 1 then @@ -3137,8 +3140,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtOutLog( sWarn) end end - -- recupero massima elevazione da Q10 - local dMaxElev = EgtGetInfo( Proc.Id, 'Q10', 'd') + -- recupero massima elevazione + local dMaxElev = Q_MAX_ELEVATION if dMaxElev and dMaxElev > 10 then local sNotes = 'MaxElev=' .. EgtNumToString( dMaxElev, 1) .. ';' EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) @@ -4637,7 +4640,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- Recupero la lavorazione di svuotatura local sMchFind = 'Pocket' -- se forzato uso truciolatore - if EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') == 1 then + if Q_USE_ROUGH_TOOL == 1 then sMchFind = 'OpenPocket' end local dDiam = min( dH, dV) @@ -4711,12 +4714,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end -- se abilitato dal parametro Q inserisco foro sullo spigolo - if EgtGetInfo( Proc.Id, Q_BORE_ON_CORNER, 'i') == 1 then + if Q_BORE_ON_CORNER == 1 then local bOk bOk, sWarn = MakeDrillOnCorner( Proc, nPhase, nRawId, nPartId, b3Raw, 0, nAddGrpId, dDiamTool, true) if not bOk then return false, sWarn end -- altrimenti se abilitato dal parametro Q inserisco percorso di pulitura - elseif EgtGetInfo( Proc.Id, Q_BORE_ON_CORNER, 'i') == 2 then + elseif Q_BORE_ON_CORNER == 2 then local bOk bOk, sWarn = MakeSharpCleanCorner( Proc, nPhase, nRawId, nPartId, b3Raw, 0, nAddGrpId, dDiamTool) if not bOk then return false, sWarn end @@ -4808,7 +4811,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- se processo 20 e non sto usando il truciolatore if bNewCheck and Proc.Prc == 20 and nUseRoughTool == 0 then -- verifico se forzato uso truciolatore - nUseRT = EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') + nUseRT = Q_USE_ROUGH_TOOL if nUseRT and nUseRT ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 @@ -4817,7 +4820,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- 03/12/2020 aggiunto controllo su feature 30 senza uso truciolatore if bNewCheck and Proc.Prc == 30 and nUseRoughTool == 0 then -- verifico se forzato uso truciolatore - nUseRT = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') + nUseRT = Q_SIDE_ROUGH_TOOL if nUseRT and nUseRT ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 @@ -4945,7 +4948,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa sPocketing = nil end -- leggo parametro Q - local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 + local nQAntisplintResult = Q_ANTISPLINT_TYPE -- se lavorazione fresa come lama disabilito eveentuale antischegggia if bSpecialMillOnSide then nQAntisplintResult = 0 end -- se non trova una svuotatura adatta @@ -5103,7 +5106,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end -- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola - local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0 + local nContourSmallTool = Q_CONTOUR_SMALL_TOOL if nContourSmallTool > 0 then local bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, dDiamTool, nContourSmallTool, bMillDown, @@ -5150,7 +5153,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end else -- se abilitato dal parametro Q inserisco pulitura spigoli o contorno con fresa più piccola - local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0 + local nContourSmallTool = Q_CONTOUR_SMALL_TOOL if nContourSmallTool > 0 then local bOk, sWarn2 bOk, sWarn2 = MakeRoundCleanCornerOrContour( Proc, nPhase, nRawId, nPartId, b3Raw, @@ -5251,8 +5254,8 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end end end - local nBoreOnCorner = EgtGetInfo( Proc.Id, Q_BORE_ON_CORNER, 'i') or 0 - local nContourSmallTool = EgtGetInfo( Proc.Id, Q_CONTOUR_SMALL_TOOL, 'i') or 0 + local nBoreOnCorner = Q_BORE_ON_CORNER + local nContourSmallTool = Q_CONTOUR_SMALL_TOOL -- se abilitato dal parametro Q inserisco foro sullo spigolo if nBoreOnCorner == 1 then local bOk, sWarn2 @@ -5357,29 +5360,29 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- in base al tipo di feature attribuisco il significato dei parametri Q AssignQIdent( Proc) -- se non forzate frese, uso la lama - local bUseBlade = EgtGetInfo( Proc.Id, Q_USE_ROUGH_TOOL, 'i') ~= 1 and EgtGetInfo( Proc.Id, Q_USE_MILL, 'i') ~= 1 + local bUseBlade = Q_USE_ROUGH_TOOL ~= 1 and Q_USE_MILL ~= 1 local nForceUseBladeOnNotContinueFace -- se ho attivo la lama e ho la feature 30, verifico i parametri Q propri della feature if bUseBlade then if Proc.Prc == 30 then - local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 - local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 - nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0 + local nBladeAntisplint = Q_ANTISPLINT_TYPE + local nUseRoughToolOnSide = Q_SIDE_ROUGH_TOOL + nForceUseBladeOnNotContinueFace = Q_BLADE_ON_ALONG_FACE -- se antischeggia di fresa o abilitato sgrossatore di fianco if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then bUseBlade = false end -- se ho attivo la lama e ho la feature 32, verifico i parametri Q propri della feature elseif Proc.Prc == 32 then - local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 - local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 + local nBladeAntisplint = Q_ANTISPLINT_TYPE + local nUseRoughToolOnSide = Q_SIDE_ROUGH_TOOL -- se antischeggia di fresa o abilitato sgrossatore di fianco if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then bUseBlade = false end -- se ho attivo la lama e ho la feature 34, verifico i parametri Q propri della feature elseif Proc.Prc == 34 then - local nBladeAntisplint = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 + local nBladeAntisplint = Q_ANTISPLINT_TYPE -- se antischeggia di fresa o abilitato sgrossatore di fianco if nBladeAntisplint == 2 then bUseBlade = false @@ -5407,8 +5410,8 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local b3Fac2 = EgtSurfTmGetFacetBBoxGlob( Proc.Id, 1, GDB_BB.STANDARD) if abs( b3Fac1:getDimX() - b3Fac2:getDimX()) < 50 then -- leggo i parametri Q per utilizzare la fresa di fianco e/o lama - local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 - local bUseBlade = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 + local nUseSideTool = Q_SIDE_ROUGH_TOOL + local bUseBlade = Q_ANTISPLINT_TYPE == 1 -- EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') == 1 ?? return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) elseif b3Fac1:getDimX() < 1 then -- la faccia 0 deve essere quella lunga @@ -5483,7 +5486,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) elseif Proc.Fct == 2 then -- se praticamente è lunga come la trave if Proc.Box:getDimX() > 0.8 * b3Solid:getDimX() then - local nUseSideTool = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 + local nUseSideTool = Q_SIDE_ROUGH_TOOL return Long2Cut.Make( Proc, nPhase, nRawId, nPartId, bUseBlade, nUseSideTool) -- altrimenti else