From 4f43d74d41799f546e84500e2ec6855753c740fa Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 5 Dec 2025 12:05:32 +0100 Subject: [PATCH] In MachiningLib e LapJoint aggiunta gestione fresatura con aggregato flottante. Per ora solo su Groove 4 facce e con Q specifia da attivare --- LuaLibs/MachiningLib.lua | 7 +++- LuaLibs/ProcessLapJoint.lua | 75 ++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 8e02439..b534a02 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -139,6 +139,7 @@ end --------------------------------------------------------------------- function VerifyMill( Machining, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bH2) if ( not dDepth or Machining.Tool.MaxMat > dDepth - GEO.EPS_SMALL) and + ( Machining.Type ~= 'FloatingAggregate' or abs( Machining.Tool.MaxMat - dDepth) < 100 * GEO.EPS_SMALL) and ( not sTuuidMstr or sTuuidMstr == Machining.Tool.UUID) and ( not dMaxDiam or Machining.Tool.Diameter < dMaxDiam + GEO.EPS_SMALL) and ( not dMaxTotLen or Machining.Tool.TotalLength < dMaxTotLen + GEO.EPS_SMALL) then @@ -227,7 +228,11 @@ function GetMachinings( MachiningType, sType) table.insert( validMachinings, Machining) -- 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 + -- caso speciale utensile su aggregato flottante + if MachiningType == MCH_MY.MILLING and sType == 'FloatingAggregate' then + local sNotes = EgtTdbGetCurrToolParam( MCH_TP.USERNOTES) + Machining.Tool.MaxMat = EgtGetValInNotes( sNotes, 'TOOL_OVERHANG', 'd') or -1 + elseif ( 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) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index c1cd91e..5c0d030 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -151,6 +151,8 @@ local Q_SAW_PLUS_CHAIN = '' -- i local Q_FORCE_CHAINSAW = '' -- i local Q_CHAINSAW_FROM_SIDE = '' -- i local Q_MILL_AS_BLADE_CONVENTIONAL = '' -- i +local Q_CLEAN_CORNER = '' -- 1 +local Q_FLOATING_AGGREGATE = '' -- i -- variabile smussi local bMadeChamfer @@ -201,6 +203,7 @@ local function AssignQIdent( Proc) Q_CHAINSAW_FROM_SIDE = 'Q999' Q_MILL_AS_BLADE_CONVENTIONAL = '' Q_CLEAN_CORNER = '' + Q_FLOATING_AGGREGATE = '' if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then Q_FORCE_BLADE = 'Q01' -- i @@ -229,6 +232,7 @@ local function AssignQIdent( Proc) Q_DEPTH_CHAMFER = 'Q07' -- d Q_MILL_AS_BLADE_CONVENTIONAL = 'Q14' -- i Q_CLEAN_CORNER = 'Q15' -- i + Q_FLOATING_AGGREGATE = 'Q16' -- i elseif ( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 30 then Q_BLADE_ON_ALONG_FACE = 'Q04' -- i elseif ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 32 then @@ -6897,8 +6901,77 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if dH * dV < 0.9 * ( bBoxF:getDimX() * bBoxF:getDimY()) and nFacInd2 and dFacElev2 < 1.5 * dFacElev and not ( Proc.Topology == 'Groove' and Proc.Fct == 2) then bSpecial3faces = true end + + local bPocketFloatingAggregate = false + -- se abilitata lavorazione con aggregato flottante + local sMillingFloatingAggregate + if Proc.Topology == 'Groove' and Proc.Fct == 4 and EgtGetInfo( Proc.Id, Q_FLOATING_AGGREGATE, 'i') == 1 then + -- verifico se è possibile lavorare con utensile su aggregato flottante + sMillingFloatingAggregate = ML.FindMilling( 'FloatingAggregate', dFacElev, nil, min( dH , dV)) + if sMillingFloatingAggregate then + if EgtMdbSetCurrMachining( sMillingFloatingAggregate) then + local sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then + local dToolDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + -- la larghezza della tasca non può superare il doppio del diametro, la lavorazione deve essere fatta con una passata di contornatura + if min( dH , dV) < dToolDiameter * 1.9 then + bPocketFloatingAggregate = true + end + end + end + end + end + + -- se posso in effetti fare fresatura con aggregato flottante + if bPocketFloatingAggregate then + -- inserisco la lavorazione di svuotatura + local sName = 'Float_Mill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMchFId = EgtAddMachining( sName, sMillingFloatingAggregate) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sMillingFloatingAggregate + EgtOutLog( sErr) + return false, sErr + end + + -- aggiungo geometria + local Geometry = {} + for Index = 1, Proc.Fct do + if nFacInd ~= Index-1 then + table.insert( Geometry, { Proc.Id, Index-1}) + end + end + EgtSetMachiningGeometry( Geometry) + + -- imposto uso faccia + local nFaceUse = BL.GetNearestParalOpposite( vtN) + EgtSetMachiningParam( MCH_MP.FACEUSE, nFaceUse) + -- piccolo offser radiale per essere sicuri di lavorare anche con tasca larga come diametro fresa + EgtSetMachiningParam( MCH_MP.OFFSR, -0.01) + + -- imposto posizione braccio porta testa + local nSCC = MCH_SCC.NONE + if not BD.C_SIMM then + if AreSameVectorApprox( vtN, Z_AX()) then + nSCC = MCH_SCC.ADIR_YM + elseif abs( vtN:getX()) < 0.1 then + nSCC = EgtIf( BL.IsPartFinalPhase( nPhase), MCH_SCC.ADIR_XM, MCH_SCC.ADIR_XP) + elseif vtN:getY() < GEO.EPS_SMALL then + nSCC = MCH_SCC.ADIR_YP + else + nSCC = MCH_SCC.ADIR_YM + end + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + -- se riconosciuta gestione 3 facce (limitatamente per ora alla feature 20) - if bSpecial3faces and Proc.Prc == 20 then + elseif bSpecial3faces and Proc.Prc == 20 then -- se smusso non è esclusivo if nChamfer < 2 then -- entrambe le facce non devono essere orientate verso il basso