From 6a6dc2756053a81cbddfe5e211265ae00f9da80c Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 20 Jun 2025 17:30:08 +0200 Subject: [PATCH 01/12] Primo commit gestione tastatura --- LuaLibs/MachiningLib.lua | 44 ++++++++++++++++++-------------- LuaLibs/ProcessProbing.lua | 52 ++++++++++++++++++++++++++++++++++++++ Process.lua | 2 +- 3 files changed, 78 insertions(+), 20 deletions(-) create mode 100644 LuaLibs/ProcessProbing.lua diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index b8970c3..d69f7f3 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -30,6 +30,7 @@ local Millings = require( 'MillingData') local Pocketings = require( 'PocketingData') local Sawings = require( 'SawingData') local Drillings = require( 'DrillData') +local Probing = require( 'ProbingData') -- tipo di teste macchina local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) @@ -196,6 +197,8 @@ function GetMachinings( MachiningType, sType) Machinings = Pocketings elseif MachiningType == MCH_MY.MORTISING then Machinings = Sawings + elseif MachiningType == MCH_MY.PROBING then + Machinings = Probing end -- scrivo i parametri utensile nella lavorazione local validMachinings = {} @@ -208,27 +211,30 @@ function GetMachinings( MachiningType, sType) if Machining.Tool.Name then if EgtTdbSetCurrTool( Machining.Tool.Name) then table.insert( validMachinings, Machining) - if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then - Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth() - else - Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) - end - if MachiningType == MCH_MY.DRILLING then - if EgtStartsWith( Machining.Type, 'Drill') then - Machining.SubType = 'Drill' - elseif EgtStartsWith( Machining.Type, 'AngleDrill') then - Machining.SubType = 'AngleDrill' - elseif EgtStartsWith( Machining.Type, 'Pocket') then - Machining.SubType = 'DrillPocket' - elseif EgtStartsWith( Machining.Type, 'Predrill') then - Machining.SubType = 'Predrill' + -- se non è tastatura, recupero dati utensile + if MachiningType ~= MCH_MY.PROBING then + if ( MachiningType == MCH_MY.MILLING) or ( MachiningType == MCH_MY.POCKETING) or ( MachiningType == MCH_MY.DRILLING and EgtStartsWith( sType, 'Pocket')) then + Machining.Tool.MaxMat = EgtTdbGetCurrToolMaxDepth() + else + Machining.Tool.MaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) end + if MachiningType == MCH_MY.DRILLING then + if EgtStartsWith( Machining.Type, 'Drill') then + Machining.SubType = 'Drill' + elseif EgtStartsWith( Machining.Type, 'AngleDrill') then + Machining.SubType = 'AngleDrill' + elseif EgtStartsWith( Machining.Type, 'Pocket') then + Machining.SubType = 'DrillPocket' + elseif EgtStartsWith( Machining.Type, 'Predrill') then + Machining.SubType = 'Predrill' + end + end + Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) + Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) + Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam() + Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72 end - Machining.Tool.Diameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) - Machining.Tool.Length = EgtTdbGetCurrToolParam( MCH_TP.LEN) - Machining.Tool.TotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) - Machining.Tool.ToolHolderDiameter = EgtTdbGetCurrToolThDiam() - Machining.Tool.ToolHolderLength = EgtTdbGetCurrToolThLength() or 72 end end end diff --git a/LuaLibs/ProcessProbing.lua b/LuaLibs/ProcessProbing.lua new file mode 100644 index 0000000..f294383 --- /dev/null +++ b/LuaLibs/ProcessProbing.lua @@ -0,0 +1,52 @@ +-- ProcessSplit.lua by Egaltech s.r.l. 2025/06/20 +-- Gestione tastatura + +-- Tabella per definizione modulo +local ProcessProbing = {} + +-- Include +require( 'EgtBase') +local BL = require( 'BeamLib') + +-- Dati +local BD = require( 'BeamData') + +--------------------------------------------------------------------- +local function GetProbingMachining( Machinings, nHead) + local sProbeMachining + + for i = 1, #Machinings do + if EgtEndsWith( Machinings[i], '_H2') then + sProbeMachining = Machinings[i] + break + end + end + + return sProbeMachining +end + +--------------------------------------------------------------------- +-- Applicazione della lavorazione +function ProcessProbing.Make( Proc, nRawId, nPartId, Info) + local bOk, sErr + + -- per eseguire tastatura servono tutti i dati, altriemnti impossibile + if Info.vtProbe and Info.ptProbe and Info.sType then + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10) -- TODO lunghezza da portare fuori come parametro + local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType) + local Probing = GetProbingMachining( Machinings, Info.nHead) + -- se c'è la linea e la lavorazione, applico + if Probing and nIdLine then + end + else + bOk = true + sErr = 'Error on probing' + end + + return bOk, sErr +end + +--------------------------------------------------------------------- +return ProcessProbing diff --git a/Process.lua b/Process.lua index ea714f4..51fd56d 100644 --- a/Process.lua +++ b/Process.lua @@ -8,7 +8,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') From 8e19e87d3f9172a7b4fef5102a6958c7f2f28f6d Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 12:15:45 +0200 Subject: [PATCH 02/12] Prima versiomne funzionante tastatura. Manca disattivazione finale --- LuaLibs/BeamExec.lua | 1 + LuaLibs/ProcessDtMortise.lua | 6 ++++ LuaLibs/ProcessProbing.lua | 61 +++++++++++++++++++++++++++++------- 3 files changed, 57 insertions(+), 11 deletions(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 60afcc9..8efc44b 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -108,6 +108,7 @@ _G.package.loaded.ProcessScarfJoint = nil _G.package.loaded.ProcessSimpleScarf = nil _G.package.loaded.ProcessStepJoint = nil _G.package.loaded.ProcessStepJointNotch = nil +_G.package.loaded.ProcessProbing = nil _G.package.loaded.ProcessProfFront = nil _G.package.loaded.ProcessProfConcave = nil _G.package.loaded.ProcessProfConvex = nil diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index ad4e66a..8954ac9 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -20,6 +20,7 @@ local ProcessDtMortise = {} require( 'EgtBase') local BL = require( 'BeamLib') local Cut = require( 'ProcessCut') +local Probe = require( 'ProcessProbing') EgtOutLog( ' ProcessDtMortise started', 1) @@ -292,6 +293,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtOutLog( sErr) return false, sErr end + + -- tastatura se richiesta + local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sMchExt} + local bProbeExecuted, sErr = Probe.Make( Proc, nPartId, Info) + -- se con tasca, la lavoro (mai in doppio) if bPocket then -- recupero il contorno della tasca (seconda curva ausiliaria) diff --git a/LuaLibs/ProcessProbing.lua b/LuaLibs/ProcessProbing.lua index f294383..8506203 100644 --- a/LuaLibs/ProcessProbing.lua +++ b/LuaLibs/ProcessProbing.lua @@ -9,39 +9,78 @@ require( 'EgtBase') local BL = require( 'BeamLib') -- Dati -local BD = require( 'BeamData') +local ML = require( 'MachiningLib') --------------------------------------------------------------------- -local function GetProbingMachining( Machinings, nHead) +local function GetProbingMachining( Machinings, sHead) local sProbeMachining for i = 1, #Machinings do - if EgtEndsWith( Machinings[i], '_H2') then + if EgtEndsWith( Machinings[i], sHead) then sProbeMachining = Machinings[i] - break + return sProbeMachining end end - + sProbeMachining = Machinings[1] return sProbeMachining end +--------------------------------------------------------------------- +local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId) + local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) + -- si porta linea di tastatura su grezzo + if AreSameVectorApprox( vtProbe, Z_AX()) then + ptProbe[3] = b3Solid:getMax():getZ() + elseif AreSameVectorApprox( vtProbe, -Z_AX()) then + ptProbe[3] = b3Solid:getMin():getZ() + elseif AreSameVectorApprox( vtProbe, Y_AX()) then + ptProbe[2] = b3Solid:getMax():getY() + elseif AreSameVectorApprox( vtProbe, -Y_AX()) then + ptProbe[2] = b3Solid:getMin():getY() + end + return ptProbe +end + --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessProbing.Make( Proc, nRawId, nPartId, Info) +function ProcessProbing.Make( Proc, nPartId, Info) local bOk, sErr -- per eseguire tastatura servono tutti i dati, altriemnti impossibile if Info.vtProbe and Info.ptProbe and Info.sType then + Info.ptProbe = MoveProbePointToRawFaces( Info.ptProbe, Info.vtProbe, nPartId) -- recupero gruppo per geometria addizionale local nAddGrpId = BL.GetAddGroup( nPartId) - local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10) -- TODO lunghezza da portare fuori come parametro + local nIdLine = EgtLinePVL( nAddGrpId, Info.ptProbe, Info.vtProbe, 10, GDB_RT.GLOB) -- TODO lunghezza da portare fuori come parametro local Machinings = GetMachinings( MCH_MY.PROBING, Info.sType) - local Probing = GetProbingMachining( Machinings, Info.nHead) - -- se c'è la linea e la lavorazione, applico - if Probing and nIdLine then + -- se c'è almeno una lavorazione, allora devo fare tastatura + if Machinings and #Machinings > 0 then + local sProbing = GetProbingMachining( Machinings, Info.sHead) + -- se c'è la linea e la lavorazione, applico + if sProbing and nIdLine then + local sName = 'DtMtProbe_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = EgtAddMachining( sName, sProbing.Name) + -- si inverte la direzione della linea, deve essere entrante, oppostaa vettore estrusione + EgtInvertCurve( nIdLine) + -- aggiungo geometria + EgtSetMachiningGeometry( {{ nIdLine, -1}}) + + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + else + bOk = false + sErr = 'Error on probing' + end + -- altrimenti tastatura non richiesta, esco + else + return true end else - bOk = true + bOk = false sErr = 'Error on probing' end From 9480453e5796dff801eccb08880f6f48ea015a4a Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 14:53:33 +0200 Subject: [PATCH 03/12] Disattivazione finale e altre modifiche --- LuaLibs/ProcessDtMortise.lua | 6 +++++- LuaLibs/ProcessProbing.lua | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 8954ac9..40cfd96 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -528,7 +528,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end -- se necessario, imposto SCC - if nSCC then + if nSCC then EgtSetMachiningParam( MCH_MP.SCC, nSCC) end -- dichiaro massima elevazione e assenza sfridi per VMill @@ -545,6 +545,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) sUserNotes = EgtSetValInNotes( sUserNotes, 'StartZmax', 2) end end + -- se c'è stata tastatura, si disattiva sull'ultima lavorazione + if bProbeExecuted and i == 1 then + sUserNotes = EgtSetValInNotes( sUserNotes, 'END-PROBE', true) + end EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) -- eseguo if not ML.ApplyMachining( true, false) then diff --git a/LuaLibs/ProcessProbing.lua b/LuaLibs/ProcessProbing.lua index 8506203..b1c48dd 100644 --- a/LuaLibs/ProcessProbing.lua +++ b/LuaLibs/ProcessProbing.lua @@ -27,16 +27,16 @@ end --------------------------------------------------------------------- local function MoveProbePointToRawFaces( ptProbe, vtProbe, nPartId) - local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) + local b3BoxPart = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) -- si porta linea di tastatura su grezzo if AreSameVectorApprox( vtProbe, Z_AX()) then - ptProbe[3] = b3Solid:getMax():getZ() + ptProbe[3] = b3BoxPart:getMax():getZ() elseif AreSameVectorApprox( vtProbe, -Z_AX()) then - ptProbe[3] = b3Solid:getMin():getZ() + ptProbe[3] = b3BoxPart:getMin():getZ() elseif AreSameVectorApprox( vtProbe, Y_AX()) then - ptProbe[2] = b3Solid:getMax():getY() + ptProbe[2] = b3BoxPart:getMax():getY() elseif AreSameVectorApprox( vtProbe, -Y_AX()) then - ptProbe[2] = b3Solid:getMin():getY() + ptProbe[2] = b3BoxPart:getMin():getY() end return ptProbe end @@ -70,6 +70,8 @@ function ProcessProbing.Make( Proc, nPartId, Info) local _, sErr = EgtGetLastMachMgrError() EgtSetOperationMode( nMchFId, false) return false, sErr + else + bOk = true end else bOk = false From 3e01fb36b0200e69a4f7b4728f8e0abc6863ed41 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 15:36:20 +0200 Subject: [PATCH 04/12] Si sceglie lavorazione che utilizza la stessa testa della lavorazione --- LuaLibs/ProcessDtMortise.lua | 4 +++- LuaLibs/ProcessProbing.lua | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 40cfd96..6069f60 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -274,6 +274,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local dToolDiam = 100 local dMaxMat = 30 local dSideAng = 0 + local sHeadTool = 'H1' local bCW = true local bMillOnAggregate = sMchExt == '_AT' if EgtMdbSetCurrMachining( sMilling) then @@ -283,6 +284,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) dToolDiam = max( dToolDiam, 10) dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng + sHeadTool = EgtTdbGetCurrToolParam( MCH_TP.HEAD) local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0 bCW = ( dSpeed >= 0) end @@ -295,7 +297,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end -- tastatura se richiesta - local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sMchExt} + local Info = { vtProbe = vtExtr, ptProbe = ptBC, sType = 'DTMortise', sHead = sHeadTool} local bProbeExecuted, sErr = Probe.Make( Proc, nPartId, Info) -- se con tasca, la lavoro (mai in doppio) diff --git a/LuaLibs/ProcessProbing.lua b/LuaLibs/ProcessProbing.lua index b1c48dd..b90cfcd 100644 --- a/LuaLibs/ProcessProbing.lua +++ b/LuaLibs/ProcessProbing.lua @@ -13,10 +13,20 @@ local ML = require( 'MachiningLib') --------------------------------------------------------------------- local function GetProbingMachining( Machinings, sHead) - local sProbeMachining + local sProbeMachining, sHeadTool + + -- TODO questa associazione "testa utensile"-"testa tastatore" dovrebbe essere spostata nella macchina. + -- Non è detto che se testa utensile inizia con "H2" allora bisogna prendere lavorazione con "_H2" + + -- se la testa utilizzata dalla lavorazione inizia con H2, dovrebbe essere la seconda testa + if EgtStartsWith( sHead, 'H2') then + sHeadTool = '_H2' + else + sHeadTool = '_H1' + end for i = 1, #Machinings do - if EgtEndsWith( Machinings[i], sHead) then + if EgtEndsWith( Machinings[i].Name, sHeadTool) then sProbeMachining = Machinings[i] return sProbeMachining end From 0f536b07c49207bbf6d991bdd326e0964f4472a4 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 16:26:39 +0200 Subject: [PATCH 05/12] Aggiornato Compile --- Compile.bat | 1 + Process.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Compile.bat b/Compile.bat index 9e11c86..4091878 100644 --- a/Compile.bat +++ b/Compile.bat @@ -45,6 +45,7 @@ REM Compilazione 32 e 64 bit \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessText.lua -s LuaLibs\ProcessText.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessTyroleanDovetail.lua -s LuaLibs\ProcessTyroleanDovetail.lua \EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessVariant.lua -s LuaLibs\ProcessVariant.lua +\EgtProg\Dll32\luac54 -o bin\LuaLibs\ProcessProbing.lua -s LuaLibs\ProcessProbing.lua \EgtProg\Dll32\luac54 -o bin\BatchProcess.lua -s BatchProcess.lua \EgtProg\Dll32\luac54 -o bin\BatchProcessNew.lua -s BatchProcessNew.lua \EgtProg\Dll32\luac54 -o bin\GetBeamData.lua -s GetBeamData.lua diff --git a/Process.lua b/Process.lua index 51fd56d..ea714f4 100644 --- a/Process.lua +++ b/Process.lua @@ -8,7 +8,7 @@ -- Intestazioni require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( true) +EgtEnableDebug( false) -- Imposto direttorio libreria specializzata per Travi EgtAddToPackagePath( BEAM.BASEDIR .. '\\LuaLibs\\?.lua') From 73c86bd35f93b8c71fb9d74bcffcbff8ff6b216b Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 24 Jun 2025 10:32:37 +0200 Subject: [PATCH 06/12] =?UTF-8?q?In=20MAchiningLib,=20le=20librerie=20di?= =?UTF-8?q?=20lavorazioni=20chiamate=20con=20pcall=20perch=C3=A8=20non=20?= =?UTF-8?q?=C3=A8=20detto=20che=20siano=20tutte=20presenti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/MachiningLib.lua | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index d69f7f3..768a9fd 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -25,12 +25,14 @@ EgtOutLog( ' MachiningLib started', 1) -- Dati local BD = require( 'BeamData') -local Cuttings = require( 'CutData') -local Millings = require( 'MillingData') -local Pocketings = require( 'PocketingData') -local Sawings = require( 'SawingData') -local Drillings = require( 'DrillData') -local Probing = require( 'ProbingData') +-- librerie lavorazioni caricate con pcall perchè potrebbero non esserci +local Cuttings, Millings, Pocketings, Sawings, Drillings, Probing +if pcall( require, 'CutData') then Cuttings = require( 'CutData') end +if pcall( require, 'MillingData') then Millings = require( 'MillingData') end +if pcall( require, 'PocketingData') then Pocketings = require( 'PocketingData') end +if pcall( require, 'SawingData') then Sawings = require( 'SawingData') end +if pcall( require, 'DrillData') then Drillings = require( 'DrillData') end +if pcall( require, 'ProbingData') then Probing = require( 'ProbingData') end -- tipo di teste macchina local ONE_HEAD = 1 -- una testa (Fast, One, Turn1T) @@ -185,20 +187,32 @@ end --------------------------------------------------------------------- function GetMachinings( MachiningType, sType) - local Machinings + local Machinings = {} -- leggo le lavorazioni disponibili if MachiningType == MCH_MY.DRILLING then - Machinings = Drillings + if Drillings and type( Drillings) == "table" then + Machinings = Drillings + end elseif MachiningType == MCH_MY.SAWING then - Machinings = Cuttings + if Cuttings and type( Cuttings) == "table" then + Machinings = Cuttings + end elseif MachiningType == MCH_MY.MILLING then - Machinings = Millings + if Millings and type( Millings) == "table" then + Machinings = Millings + end elseif MachiningType == MCH_MY.POCKETING then - Machinings = Pocketings + if Pocketings and type( Pocketings) == "table" then + Machinings = Pocketings + end elseif MachiningType == MCH_MY.MORTISING then - Machinings = Sawings + if Sawings and type( Sawings) == "table" then + Machinings = Sawings + end elseif MachiningType == MCH_MY.PROBING then - Machinings = Probing + if Probing and type( Probing) == "table" then + Machinings = Probing + end end -- scrivo i parametri utensile nella lavorazione local validMachinings = {} From 4adf62069fd4a822a95a2f61a8c3fb5f9292d1e7 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 24 Jun 2025 12:34:12 +0200 Subject: [PATCH 07/12] In RidgeLap, si utilizza direzione reale della faccia. Prima era solo verso X --- LuaLibs/ProcessRidgeLap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaLibs/ProcessRidgeLap.lua b/LuaLibs/ProcessRidgeLap.lua index df34b2b..dbfc145 100644 --- a/LuaLibs/ProcessRidgeLap.lua +++ b/LuaLibs/ProcessRidgeLap.lua @@ -173,7 +173,7 @@ function ProcessRidgeLap.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- calcolo riferimenti per facce inclinate local vtRef = Vector3d( vtN[vFaceOrd[3]]) - local vtRef2 = EgtIf( bHead, X_AX(), -X_AX()) + local vtRef2 = Vector3d( vtN[vFaceOrd[2]]) -- eseguo for i = 1, #vCuts do local nOrthoOpposite From b08710451a4ab68cb13366ab1c236bac87413f0f Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 24 Jun 2025 14:50:20 +0200 Subject: [PATCH 08/12] In Drill, se foro in testa che attraversa un taglio, si setta sempre la MaxElev. Serve in caso ci sia un grande sovramateriale di testa --- LuaLibs/ProcessDrill.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index d29dd7c..7856b25 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -546,7 +546,7 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) if bIntersectionOk then local dHoleToCutDistance = vDistance[1] -- se il taglio accorcia realmente il foro - if dHoleToCutDistance > 10 * GEO.EPS_SMALL and dHoleToCutDistance < dLen then + if ( dHoleToCutDistance > 10 * GEO.EPS_SMALL or Proc.AffectedFaces.Right) and dHoleToCutDistance < dLen then dMaxDepth = dMaxDepthOri dMaxElev = dLen - dHoleToCutDistance bTryDrill = true From 2430b4e78797eb653e5f12b921fe674ca226aeab Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 24 Jun 2025 17:19:47 +0200 Subject: [PATCH 09/12] - in LapJoint si contempla Q13 per forzare la non rotazione. In questo caso, per sega a catena con groove 4 lati, si accetta di entrare di lato (Plunge=10) --- LuaLibs/ProcessLapJoint.lua | 86 +++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 17 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a77efe3..46bec28 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -192,6 +192,7 @@ local function AssignQIdent( Proc) Q_STAIRCASE = '' Q_SAW_PLUS_CHAIN = 'Q11' Q_FORCE_CHAINSAW = 'Q12' + Q_NO_ROTATION = 'Q13' if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then Q_FORCE_BLADE = 'Q01' -- i @@ -965,6 +966,12 @@ function ProcessLapJoint.Classify( Proc, b3Raw) bDown = ( vtN2:getZ() < BD.NZ_MINB) end end + + local bNoRotation = ( EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') or 0) == 1 + if bDown and bNoRotation then + bDown = false + end + return true, bDown end end @@ -3089,8 +3096,14 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local bGoFromHead = true -- se la lunghezza utensile non riesce ad arrivare sul fondo assegno la possibilità di lavorare di fianco (se possibile) if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then - -- continuo di testa se fessura con tre facce o non è tunnel - bGoFromHead = (( bIs3Faces and dMaxElev) or not bOrthoFaces) + local bNoRotation = EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') + -- se forzata no rotazione, si entra dal lato se possibile + if bNoRotation and ( Proc.Fct == 4) and ( Proc.Topology == 'Groove') then + bGoFromHead = false + else + -- continuo di testa se fessura con tre facce o non è tunnel + bGoFromHead = (( bIs3Faces and dMaxElev) or not bOrthoFaces) + end end -- se continuo a lavorare di testa if bGoFromHead then @@ -3187,16 +3200,34 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sWarn end end - -- altrimenti sega a catena di fianco + -- altrimenti sega a catena di fianco + -- si arriva qui anche per groove 4 lati con rotazione esclusa else - -- verifico se posso farlo con la sega-catena + local vtRef = Vector3d( vtOrtho) + if vtRef and ( vtRef:getY() > 0.5 or vtRef:getZ() < -0.1) then + vtRef = -vtRef + end + if not ( Proc.Topology == 'Tunnel') then + dDimMin = min( Proc.Face[ nFacInd - 1].Width, Proc.Face[ nFacInd - 1].Height) + dDimMax = min( Proc.Face[ nFacAdj - 1].Width, Proc.Face[ nFacAdj - 1].Height) + nLundIdFace = nFacAdj + local nFaceZ + if not vtRef then + if Proc.AffectedFaces.Top then + vtRef = Z_AX() + nFaceZ = BL.FindFaceBestOrientedAsAxis( Proc, Z_AX()) + else + vtRef = -Z_AX() + nFaceZ = BL.FindFaceBestOrientedAsAxis( Proc, -Z_AX()) + end + end + dDepth = Proc.Face[ nFaceZ + 1].Elevation + end local bMakeChainSaw, sSawing2, dMaxMat2, dSawCornerRad2, dSawThick2 = VerifyChainSaw( Proc, dDimMin, dDimMax, dDepth) if bMakeChainSaw then -- Calcolo normale faccia da lavorare local vtNL = EgtSurfTmFacetNormVersor( Proc.Id, nLundIdFace, GDB_ID.ROOT) -- Calcolo uso faccia - local vtRef = Vector3d( vtOrtho) - if vtRef:getY() > 0.5 or vtRef:getZ() < -0.1 then vtRef = -vtRef end local nFaceUse = BL.GetNearestParalOpposite( vtRef, vtNL) -- Verifico se necessarie più passate local nStep = ceil( ( dDimMin - 100 * GEO.EPS_SMALL) / dSawThick2) @@ -3223,21 +3254,42 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) - -- se possibile aumento l'affondamento pari al raggio corner + 1 - if dMaxMat2 > ( dDepth + dSawCornerRad2 + 1) then - EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1)) - -- se massimo affondamento supera altezza fessura, uso massimo affondamento - elseif dMaxMat2 > (dDepth + 1) then - EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1)) - -- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning - elseif dMaxMat2 < dDepth then - EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2) - sWarn = 'Warning : elevation bigger than max tool depth' - EgtOutLog( sWarn) + if Proc.Topology == 'Tunnel' then + -- se possibile aumento l'affondamento pari al raggio corner + 1 + if dMaxMat2 > ( dDepth + dSawCornerRad2 + 1) then + EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1)) + -- se massimo affondamento supera altezza fessura, uso massimo affondamento + elseif dMaxMat2 > (dDepth + 1) then + EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1)) + -- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning + elseif dMaxMat2 < dDepth then + EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2) + sWarn = 'Warning : elevation bigger than max tool depth' + EgtOutLog( sWarn) + end + else + -- se possibile si lavora tutta la profondità + if dMaxMat2 > (dDepth - 100 * GEO.EPS_SMALL) then + EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + -- in alternativa si arriva al massimo materiale + else + EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2) + sWarn = 'Warning : elevation bigger than max tool depth' + EgtOutLog( sWarn) + end + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ)) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dSawWidth / 2) end -- considero estremi inizio/fine chiusi -- imposto massima elevazione + if not ( Proc.Topology == 'Tunnel') then + local dLongitudinalStep = EgtGetMachiningParam( MCH_MP.STEP) + dElev = dLongitudinalStep + 0.1 + end local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' + if not ( Proc.Topology == 'Tunnel') then + sNotes = EgtSetValInNotes( sNotes, 'Plunge', 10) + end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) -- eseguo if not ML.ApplyMachining( true, false) then From c0156a4a97baf56aaddccf4083bf82e3ee483bd4 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 25 Jun 2025 11:43:27 +0200 Subject: [PATCH 10/12] =?UTF-8?q?In=20LongDoubleCut,=20se=20la=20faccia=20?= =?UTF-8?q?scelta=20non=20=C3=A8=20completa,=20si=20=20lavora=20l'altra=20?= =?UTF-8?q?faccia=20(se=20completa)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLongDoubleCut.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f64cc41..5238263 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1306,6 +1306,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- ciclo sulle parti local nM = 0 + local bInverted = false for j = 1, nC do -- su entrambe le facce for i = nIni, nFin do @@ -1349,8 +1350,19 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- controllo se lavorazione completa local dMachDepth = vElevation[vOrd[i]] if dMachDepth > dMaxDepth - 10 * GEO.EPS_ANG_SMALL then - sWarn = 'Warning : elevation bigger than max tool depth' - EgtOutLog( sWarn) + -- verifico se posso lavorare la faccia 2 + local nOtherFace = EgtIf( i == 1, 2, 1) + if j == 1 and vtN[vOrd[nOtherFace]]:getZ() > dLimitAngle and vWidth[vOrd[i]] < dMaxDepth then + vOrd[1], vOrd[2] = vOrd[2], vOrd[1] + dLargh = vWidth[vOrd[i]] + dSal, dEal = dEal, dSal + bInverted = true + else + sWarn = 'Warning : elevation bigger than max tool depth' + EgtOutLog( sWarn) + end + elseif bInverted then + dSal, dEal = dEal, dSal end if not bSide and dLargh > 0.8 * dToolDiam then nO = ceil( dLargh / ( 0.6 * dToolDiam)) From 9869d1a61e6b418b198d4bea2659e6f622bd3bf1 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 25 Jun 2025 15:25:47 +0200 Subject: [PATCH 11/12] - in LapJoint migliorata sega a catena con attacco laterale --- LuaLibs/ProcessLapJoint.lua | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 46bec28..0b2cd2b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3254,37 +3254,50 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- imposto offset radiale local dOffs = ( i - 1) * dStep EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) + local dMachiningDepth = dDepth if Proc.Topology == 'Tunnel' then -- se possibile aumento l'affondamento pari al raggio corner + 1 if dMaxMat2 > ( dDepth + dSawCornerRad2 + 1) then - EgtSetMachiningParam( MCH_MP.DEPTH, (dDepth + dSawCornerRad2 + 1)) + dMachiningDepth = ( dDepth + dSawCornerRad2 + 1) -- se massimo affondamento supera altezza fessura, uso massimo affondamento - elseif dMaxMat2 > (dDepth + 1) then - EgtSetMachiningParam( MCH_MP.DEPTH, (dMaxMat2 - 1)) + elseif dMaxMat2 > ( dDepth + 1) then + dMachiningDepth = (dMaxMat2 - 1) -- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning elseif dMaxMat2 < dDepth then - EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2) + dMachiningDepth = dMaxMat2 sWarn = 'Warning : elevation bigger than max tool depth' EgtOutLog( sWarn) end + EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth) else -- se possibile si lavora tutta la profondità if dMaxMat2 > (dDepth - 100 * GEO.EPS_SMALL) then - EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) + dMachiningDepth = dDepth -- in alternativa si arriva al massimo materiale else - EgtSetMachiningParam( MCH_MP.DEPTH, dMaxMat2) + dMachiningDepth = dMaxMat2 sWarn = 'Warning : elevation bigger than max tool depth' EgtOutLog( sWarn) end + EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth) EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ)) EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dSawWidth / 2) end - -- considero estremi inizio/fine chiusi - -- imposto massima elevazione + -- in caso di attacco esterno si setta in modo da fare un primo step da 250 (se MaxMat 150) per evitare finecorsa + -- si riduce la feed opportunamente if not ( Proc.Topology == 'Tunnel') then - local dLongitudinalStep = EgtGetMachiningParam( MCH_MP.STEP) - dElev = dLongitudinalStep + 0.1 + local dMachiningStep = EgtGetMachiningParam( MCH_MP.STEP) or 0 + dMachiningStep = dMachiningStep * 1.67 + local dActualStep = ( dMachiningDepth - dMachiningStep) / ( 2 + 1) + dElev = dMachiningDepth - dMachiningStep + dActualStep + if dActualStep < 0 then + dActualStep = 1 + dElev = 2 + end + EgtSetMachiningParam( MCH_MP.STEP, dActualStep) + + local dFeed = EgtGetMachiningParam( MCH_MP.FEED) / 2 + EgtSetMachiningParam( MCH_MP.FEED, dFeed) end local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' if not ( Proc.Topology == 'Tunnel') then From 85e6c3c86d4a4c4fa9771615c95ce5b72ad9c583 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 26 Jun 2025 14:48:59 +0200 Subject: [PATCH 12/12] - in LapJoint migliorata sega a catena con attacco laterale --- LuaLibs/ProcessLapJoint.lua | 42 +++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 0b2cd2b..56de528 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3094,14 +3094,18 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end local bGoFromHead = true - -- se la lunghezza utensile non riesce ad arrivare sul fondo assegno la possibilità di lavorare di fianco (se possibile) - if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then - local bNoRotation = EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') - -- se forzata no rotazione, si entra dal lato se possibile - if bNoRotation and ( Proc.Fct == 4) and ( Proc.Topology == 'Groove') then + local bAttackFromSide = ( ( EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') or 0) == 1) + and ( Proc.Fct == 4) and ( Proc.Topology == 'Groove') + -- se normale lungo Z è da sopra: si tenta attacco laterale se richiesto + if AreSameOrOppositeVectorApprox( Proc.Face[ nFacInd + 1].VtN, Z_AX()) then + if bAttackFromSide then bGoFromHead = false + end + elseif dElev > dMaxDepth + 10 * GEO.EPS_SMALL then + if bAttackFromSide then + bGoFromHead = false + -- continuo di testa se fessura con tre facce o non è tunnel else - -- continuo di testa se fessura con tre facce o non è tunnel bGoFromHead = (( bIs3Faces and dMaxElev) or not bOrthoFaces) end end @@ -3208,8 +3212,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, vtRef = -vtRef end if not ( Proc.Topology == 'Tunnel') then - dDimMin = min( Proc.Face[ nFacInd - 1].Width, Proc.Face[ nFacInd - 1].Height) - dDimMax = min( Proc.Face[ nFacAdj - 1].Width, Proc.Face[ nFacAdj - 1].Height) + dDimMin = min( Proc.Face[ nFacInd + 1].Width, Proc.Face[ nFacInd + 1].Height) + dDimMax = min( Proc.Face[ nFacAdj + 1].Width, Proc.Face[ nFacAdj + 1].Height) nLundIdFace = nFacAdj local nFaceZ if not vtRef then @@ -3280,16 +3284,28 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtOutLog( sWarn) end EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth) - EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ)) - EgtSetMachiningParam( MCH_MP.ENDADDLEN, - dSawWidth / 2) + local dStartAddLen = dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ) + local dEndAddLen = - dSawWidth / 2 + if vtRef:getZ() > 10 * GEO.EPS_SMALL then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MORTISE_WS.LEFT) + EgtSetMachiningParam( MCH_MP.INVERT, true) + end + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end - -- in caso di attacco esterno si setta in modo da fare un primo step da 250 (se MaxMat 150) per evitare finecorsa + -- in caso di attacco esterno si setta in modo da fare un primo step adeguato per evitare finecorsa -- si riduce la feed opportunamente if not ( Proc.Topology == 'Tunnel') then local dMachiningStep = EgtGetMachiningParam( MCH_MP.STEP) or 0 - dMachiningStep = dMachiningStep * 1.67 + -- TODO qui sostituire con valore preciso da GetSetupInfo + if BD.C_SIMM then + dMachiningStep = 165 + if vtRef:getZ() < - 10 * GEO.EPS_SMALL then + dMachiningStep = 250 + end + end local dActualStep = ( dMachiningDepth - dMachiningStep) / ( 2 + 1) - dElev = dMachiningDepth - dMachiningStep + dActualStep + dElev = dMachiningDepth - dMachiningStep + dActualStep - 0.1 if dActualStep < 0 then dActualStep = 1 dElev = 2