From b5145d4e99daa11f0d3eee709f9dffdd873a4199 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 17 Jun 2025 09:46:18 +0200 Subject: [PATCH 01/28] =?UTF-8?q?-=20in=20MachiningLib=20si=20gestisce=20s?= =?UTF-8?q?ortingCriterion=20anche=20per=20fresatura=20-=20in=20DtMortise?= =?UTF-8?q?=20gestita=20lavorazione=20a=20pi=C3=B9=20passate=20per=20morta?= =?UTF-8?q?sa=20profonda=20-=20in=20DtTenon=20se=20profondit=C3=A0=20eleva?= =?UTF-8?q?ta=20si=20cerca=20una=20fresa=20pi=C3=B9=20lunga?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/MachiningLib.lua | 4 +- LuaLibs/ProcessDtMortise.lua | 136 ++++++++++++++++++++++++++++++++--- LuaLibs/ProcessDtTenon.lua | 29 ++++++-- UpdateLog.txt | 2 +- 4 files changed, 154 insertions(+), 17 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index b8970c3..812ad32 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -481,8 +481,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead) end --------------------------------------------------------------------- -function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3) - return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3) +function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) + return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index ad4e66a..74992bc 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -103,7 +103,7 @@ function ProcessDtMortise.GetCutPlane( Proc) end --------------------------------------------------------------------- -local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid) +local function CalcPathAtHeight( nProcId, AuxId, nAddGrpId, dHeight, dSideAng, b3Solid) -- copio la curva di base local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) if not NewAuxId then return end @@ -111,7 +111,7 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtMergeCurvesInCurveCompo( NewAuxId) - local dOffset = dAltMort * tan( dSideAng) + local dOffset = dHeight * tan( dSideAng) if not EgtOffsetCurve( NewAuxId, dOffset) then return end -- la limito entro la trave local refBox = Frame3d( b3Solid:getMin()) @@ -119,7 +119,7 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol local nCount NewAuxId, nCount = EgtTrimFlatCurveWithBox( NewAuxId, refBox, vtBoxDiag, true, true, GDB_RT.GLOB) -- eseguo traslazione e offset per portarla sul top - local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dAltMort - 10 * GEO.EPS_SMALL) + local vtMove = EgtCurveExtrusion( AuxId, GDB_RT.GLOB) * ( dHeight - 10 * GEO.EPS_SMALL) EgtMove( NewAuxId, vtMove, GDB_RT.GLOB) -- se divisa in più parti, le unisco congiungendole con segmenti if nCount > 1 then @@ -136,6 +136,23 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol return NewAuxId end +--------------------------------------------------------------------- +local function GetVerticalSteps( dMachiningDepth, dStep ) + local MachiningSteps = {} + MachiningSteps.StepLength = 0 + + if dMachiningDepth <= 0 then + MachiningSteps.Count = 0 + return MachiningSteps + end + + MachiningSteps.Count = ceil( (dMachiningDepth - 10 * GEO.EPS_SMALL) / dStep ) + + MachiningSteps.StepLength = dMachiningDepth / MachiningSteps.Count + + return MachiningSteps +end + --------------------------------------------------------------------- -- verifica che il box includa il punto in XY function EnclosesPoint( b3Box, ptP) @@ -154,6 +171,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) + bMakeAntiSplitPath = true -- ingombro del pezzo local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) if not b3Solid then @@ -286,12 +304,56 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) bCW = ( dSpeed >= 0) end end - -- verifico che la profondità non superi il massimo materiale dell'utensile + local bMultipleZPasses = false + -- se necessario, cerco un utensile più lungo if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then - local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge' - EgtOutLog( sErr) - return false, sErr + -- recupero la lavorazione : prima ricerca per sola tipologia + sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') + if not sMilling and bMillUp then + sMilling = ML.FindMilling( sMillType, nil, nil, nil, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') + end + if not sMilling then + local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id) + EgtOutLog( sErr) + return false, sErr + end + -- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo + sMilling = ML.FindMilling( sMillType..sMchExt, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') + if not sMilling and bMillUp then + sMilling = ML.FindMilling( sMillType, nil, nil, 2 * dMinRad, nil, bMillUp, bMillDown, bExcludeH2, nil, 'Longest') + sMchExt = '' + end + if not sMilling then + local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id) + EgtOutLog( sErr) + return false, sErr + end + if not sMilling then + local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge' + EgtOutLog( sErr) + return false, sErr + end + -- riassegno dati utensile + dToolDiam = 100 + dMaxMat = 30 + dSideAng = 0 + bCW = true + bMillOnAggregate = sMchExt == '_AT' + if EgtMdbSetCurrMachining( sMilling) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam + dToolDiam = max( dToolDiam, 10) + dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat + dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng + local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0 + bCW = ( dSpeed >= 0) + end + end + + bMultipleZPasses = true end + -- se con tasca, la lavoro (mai in doppio) if bPocket then -- recupero il contorno della tasca (seconda curva ausiliaria) @@ -374,7 +436,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- calcolo il percorso top mortise - local nAuxId1 = CalcTopPath( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid) + local nAuxId1 = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dAltMort, dSideAng, b3Solid) -- se esiste il percorso if nAuxId1 then -- creo percorso sulla parte alta della mortasa @@ -433,6 +495,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.DEPTH, dAltMort) -- setto offset radiale con aggiunto un ulteriore allargamento di 1mm EgtSetMachiningParam( MCH_MP.OFFSR, dToolRadDelta - 1) + -- antischeggia sempre con una passata + if bMultipleZPasses then + EgtSetMachiningParam( MCH_MP.STEP, 0) + end -- sistemo il lato e la direzione di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) @@ -476,6 +542,23 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local dStep = 0 if nPass > 1 then dStep = max( ( dDist - 2 * dToolDiam) / ( 2 * nPass - 2), 0.25 * dToolDiam) end + + local dVerticalStep = 0 + if bMultipleZPasses then + local dToolVerticalStep = 0 + if EgtMdbSetCurrMachining( sMilling) then + dToolVerticalStep = EgtMdbGetCurrMachiningParam( MCH_MP.STEP) or 0 + end + if dToolVerticalStep < 10 * GEO.EPS_SMALL then + dToolVerticalStep = dMaxMat / 3 + else + dToolVerticalStep = min( dToolVerticalStep, dMaxMat / 3) + end + local VerticalSteps = GetVerticalSteps( dAltMort, dToolVerticalStep) + dVerticalStep = VerticalSteps.StepLength + nPass = VerticalSteps.Count + end + for i = nPass, 1, -1 do -- inserisco la lavorazione di contornatura local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass) @@ -486,10 +569,39 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- aggiungo geometria - EgtSetMachiningGeometry( {{ AuxId, -1}}) + local GeomId = AuxId + if ( i > 1) and bMultipleZPasses then + local dCurrentHeight = dAltMort - ( ( nPass - i + 1) * dVerticalStep) + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + local b3MortiseNoPocket = EgtGetBBoxGlob( AuxId, GDB_BB.STANDARD) + GeomId = CalcPathAtHeight( Proc.Id, AuxId, nAddGrpId, dCurrentHeight, dSideAng, b3MortiseNoPocket) + if not GeomId then + local sErr = 'Wrong geometry : Error on DtMortise ' .. tostring( Proc.Id) + EgtOutLog( sErr) + return false, sErr + end + end + EgtSetMachiningGeometry( {{ GeomId, -1}}) -- imposto offset local dOffs = ( i - 1) * dStep + if bMultipleZPasses then + if i > 1 then + dOffs = 1 + else + dOffs = 0 + end + end EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) + -- in caso di passate in Z già calcolate lo step deve essere nullo per garantire passate singole + if bMultipleZPasses then + EgtSetMachiningParam( MCH_MP.STEP, 0) + end -- sistemo il lato e la direzione di lavoro EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true)) @@ -526,7 +638,11 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.SCC, nSCC) end -- dichiaro massima elevazione e assenza sfridi per VMill - local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxMat - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';' + local dMaxElev = dMaxMat + if bMultipleZPasses then + dMaxElev = dVerticalStep + end + local sUserNotes = EgtSetVal( 'MaxElev', EgtNumToString( dMaxElev - 0.1, 1)) .. ';' .. EgtSetVal( 'VMRS', 0) .. ';' -- in presenza di pocket dichiaro che non sto entrando e uscendo nel grezzo if bPocket then sUserNotes = EgtSetValInNotes( sUserNotes, 'OutRaw', 3) diff --git a/LuaLibs/ProcessDtTenon.lua b/LuaLibs/ProcessDtTenon.lua index ce528d3..fe14138 100644 --- a/LuaLibs/ProcessDtTenon.lua +++ b/LuaLibs/ProcessDtTenon.lua @@ -236,11 +236,32 @@ function ProcessDtTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) bCW = ( dSpeed >= 0) end end - -- verifico che l'altezza non superi il massimo materiale dell'utensile + -- se necessario, cerco un utensile più lungo if dDtTenH > dMaxMat + 10 * GEO.EPS_SMALL then - local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge' - EgtOutLog( sErr) - return false, sErr + sMilling = ML.FindMilling( sMillType .. EgtIf( bMillDown and not bMillUp, '_H2', ''), nil, nil, nil, nil, bMillUp, bMillDown, nil, nil, 'Longest') + if not sMilling then + local sErr = 'Error : milling not found in library' + EgtOutLog( sErr) + return false, sErr + end + if not sMilling then + local sErr = 'Error : DtTenon Height bigger than Tool Cutting edge' + EgtOutLog( sErr) + return false, sErr + end + -- riassegno dati utensile + dTDiam = 50 + dMaxMat = 30 + bCW = true + if EgtMdbSetCurrMachining( sMilling) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam + dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat + local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0 + bCW = ( dSpeed >= 0) + end + end end -- calcolo distanza massima della curva dal punto più lontano della base tenone Dt (facet 0) local dMaxDist diff --git a/UpdateLog.txt b/UpdateLog.txt index c03e8fe..7ff2ec2 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -11,10 +11,10 @@ Versione 2.7e2 (23/05/2025) - Fixed : in Scarf Joint correzione alla scelta faccia da lavorare Versione 2.7e1 (05/05/2025) +- Modif : in LapJoint se tunnel verticale lavorato solo da sopra e l'utensile non arriva, si restituisce warning - Fixed : in taglio di separazione si riduce percorso di taglio solo se il pezzo è effettivamente alto - Fixed : in foratura corretto caso in cui non si sceglieva l'utensile più lungo disponibile - Fixed : In BatchProcess (Ts7) corretta generazione in caso di progetto senza ricalcolo -- Modif : in LapJoint se tunnel verticale lavorato solo da sopra e l'utensile non arriva, si restituisce warning Versione 2.7d3 (22/04/2025) - Fixed : in LapJoint corretta gestione errata Q04 From 67bb55537e6a96b69aaad6fab223710fd6d834ea Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 19 Jun 2025 15:42:07 +0200 Subject: [PATCH 02/28] In LapJoint, aggiunti smussi anche se lavorazione con truciolatore --- LuaLibs/ProcessLapJoint.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 0b63fe5..a77efe3 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -7515,6 +7515,22 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) return MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, true) -- se ortogonali e non forzata lama, con fresa elseif not bUseBlade then + -- verifico se devo fare prima gli smussi + -- recupero gruppo per geometria addizionale + local nAddGrpId = BL.GetAddGroup( nPartId) + if not nAddGrpId then + local sErr = 'Error : missing AddGroup' + EgtOutLog( sErr) + return false, sErr + end + -- verifiche per smusso + local nChamfer, dDepthCham, sErrCham = EvaluateQParam( Proc) + -- se smusso da fare + if nChamfer > 0 then + local _, _, _, vtOrtho, _, nSurfInt = BL.GetTunnelDimension( Proc, nPartId) + local nOk, sErr = MakeChamfer( Proc, true, nAddGrpId, vtOrtho, b3Solid, nSurfInt, dDepthCham) + if nOk < 0 then return false, sErr end + end -- se piccole if Proc.Box:getDimX() < MAX_MILL_LIN and ( Proc.Box:getDimZ() < MAX_MILL_LIN or Proc.Box:getDimY() < MAX_MILL_LIN) and bAdj and abs( dAng + 90) < 1 then return MakeTwoFacesByMill( Proc, nPhase, nRawId, nPartId, bDownHeadMill) From 7bb237f7d2b813f94cfdf449cd62ded62cdf043f Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 19 Jun 2025 17:54:50 +0200 Subject: [PATCH 03/28] - nei tagli bForceTangentLeadInOut sostituita da sLeadInOutType per forzare il tipo di attacco --- LuaLibs/FacesBySaw.lua | 10 +++++----- LuaLibs/ProcessCut.lua | 13 ++++++++----- LuaLibs/ProcessHeadCut.lua | 20 +++++++++++++------- LuaLibs/ProcessSplit.lua | 20 +++++++++++++------- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index c7da7aa..834f758 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -46,7 +46,7 @@ local BD = require( 'BeamData') local ML = require( 'MachiningLib') --------------------------------------------------------------------- -function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut) +function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType) EgtOutLog( 'FacesBySaw.MakeParallelOne', 3) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) @@ -77,7 +77,7 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end - if bForceTangentLeadInOut or ( Ktp * dLi2Tang < dLiPerp) then + if ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp) then bLioTang = true dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp if BD.TURN then @@ -214,7 +214,7 @@ local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO) end --------------------------------------------------------------------- -function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, bForceTangentLeadInOut, Par5Alternative) +function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, sLeadInOutType, Par5Alternative) -- se lama con asse parallelo alla faccia, passo alla apposita funzione if ( Par5 == MCH_MILL_FU.PARAL_DOWN or Par5 == MCH_MILL_FU.PARAL_TOP or @@ -222,7 +222,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw Par5 == MCH_MILL_FU.PARAL_BACK or Par5 == MCH_MILL_FU.PARAL_LEFT or Par5 == MCH_MILL_FU.PARAL_RIGHT) then - return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bForceTangentLeadInOut) + return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType) end -- la lama ha asse perpendicolare alla faccia EgtOutLog( 'FacesBySaw.MakeOne', 3) @@ -457,7 +457,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end - if ( bForceTangentLeadInOut or ( not bDownUp or abs( vtTg:getY()) > 0.5) and + if ( ( sLeadInOutType == 'Tangent') or ( not bDownUp or abs( vtTg:getY()) > 0.5) and ( not bDownHead or abs( vtTg:getZ()) < 0.51) and abs( vtTg:getX()) < 0.9848 and ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 947bdde..5ed660f 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -261,7 +261,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione con testa da sopra -local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut) +local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) local sWarn -- ingombro del grezzo b3Raw = b3Raw or EgtGetRawPartBBox( nRawId) @@ -596,8 +596,11 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b if ( i % 2 == 0) and ( Proc.Fct == 1) and bNoPerpCuts then vtOrthoOAlternative = - vtOrthoO end - bForceTangentLeadInOut = bForceTangentLeadInOut and ( ( i % 2) ~= 0) - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, bForceTangentLeadInOut, vtOrthoOAlternative) + local sLeadInOutTypeFbs = 'Calculated' + if ( sLeadInOutType == 'Tangent') and ( ( i % 2) ~= 0) then + sLeadInOutTypeFbs = 'Tangent' + end + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative) if not bOk then return bOk, sErr end end end @@ -838,7 +841,7 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione -function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, bForceTangentLeadInOut) +function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, dOvmTail, bUpdateIng, nLimitingSurf, sLeadInOutType) -- sovramateriale di coda dOvmTail = dOvmTail or BD.OVM_MID -- ingombro del grezzo @@ -878,7 +881,7 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local sWarn -- se taglio con testa da sopra if not bDownHead and not bDownTurn then - local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, bForceTangentLeadInOut) + local bOk, sErr, bNoDicing2 = MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, bCustDiceCut, bForced, b3Raw, sNotes, nLimitingSurf, sLeadInOutType) bNoDicing = bNoDicing2 if not bOk then return false, sErr diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index be5a112..54faa75 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -177,8 +177,11 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut) + local sLeadInOutType = 'Calculated' + if BD.PRESS_ROLLER and not BD.DOWN_HEAD then + sLeadInOutType = 'Tangent' + end + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end @@ -240,8 +243,11 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut for j = nHorizontalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut) + local sLeadInOutType = 'Calculated' + if BD.PRESS_ROLLER then + sLeadInOutType = 'Tangent' + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end -- se necessario taglio verticale doppio, eseguo l'opposto @@ -505,11 +511,11 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end -- tagli aggiuntivi non necessari else - local bForceTangentLeadInOut = false + local sLeadInOutType = 'Calculated' if BD.PRESS_ROLLER then - bForceTangentLeadInOut = true + sLeadInOutType = 'Tangent' end - bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, bForceTangentLeadInOut) + bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, sLeadInOutType) end return bOk, sErr end diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index f2d888d..4dae7ce 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -352,8 +352,11 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER and not BD.DOWN_HEAD - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, bForceTangentLeadInOut) + local sLeadInOutType = 'Calculated' + if BD.PRESS_ROLLER and not BD.DOWN_HEAD then + sLeadInOutType = 'Tangent' + end + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end @@ -422,8 +425,11 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut for j = nHorizontalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j - local bForceTangentLeadInOut = BD.PRESS_ROLLER - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, bForceTangentLeadInOut) + local sLeadInOutType = 'Calculated' + if BD.PRESS_ROLLER then + sLeadInOutType = 'Tangent' + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return false, sErr end end -- se necessario taglio verticale doppio, eseguo l'opposto @@ -778,11 +784,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- tagli aggiuntivi non necessari else - local bForceTangentLeadInOut = false + local sLeadInOutType = 'Calculated' if BD.PRESS_ROLLER then - bForceTangentLeadInOut = true + sLeadInOutType = 'Tangent' end - bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, bForceTangentLeadInOut) + bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, sLeadInOutType) end if sNotesFinal then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotesFinal) From 6a6dc2756053a81cbddfe5e211265ae00f9da80c Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Fri, 20 Jun 2025 17:30:08 +0200 Subject: [PATCH 04/28] 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 1e2f55993753f5272ccf470bb978799419c3aae6 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 20 Jun 2025 17:59:14 +0200 Subject: [PATCH 05/28] - in HeadCut e Split i tagli aggiuntivi di spezzatura sono ora con attacco perpendicolare e OutRaw=3 (non tornano ogni volta indietro fino al grezzo ipotetico); risolto, presumibilmente, il caso dei rulli che si chiudono - modificate di conseguenza Cut e FacesBySaw --- LuaLibs/FacesBySaw.lua | 34 ++++++++++++++++++++++++++++++++-- LuaLibs/ProcessCut.lua | 10 ++++++++-- LuaLibs/ProcessHeadCut.lua | 18 +++++------------- LuaLibs/ProcessSplit.lua | 15 +++------------ 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 834f758..623c369 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -68,16 +68,28 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD local dLiPerp = dDistX + dCutExtra + dCutSic local dLoTang = dLiTang local dLoPerp = dLiPerp + local dLiCompLength = 0 + local dLoCompLength = 0 -- lunghezza attacco/uscita tangenti local dLi2Tang = dSawDiam / 2 + dCutSic local dLi2Perp = 0 local dLo2Tang = dLi2Tang local dLo2Perp = dLi2Perp + local dLi2CompLength = 0 + local dLo2CompLength = 0 -- scelgo l'attacco più conveniente local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end - if ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp) then + if ( sLeadInOutType == 'PerpendicularOutraw') then + bLioTang = false + dLiCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLoCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiTang = 5 + dLoTang = 5 + dLiPerp = 0 + dLoPerp = 0 + elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp)) then bLioTang = true dLiTang, dLiPerp, dLoTang, dLoPerp = dLi2Tang, dLi2Perp, dLo2Tang, dLo2Perp if BD.TURN then @@ -136,9 +148,11 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD -- imposto attacco/uscita EgtSetMachiningParam( MCH_MP.LITANG, dLiTang) EgtSetMachiningParam( MCH_MP.LIPERP, dLiPerp) + EgtSetMachiningParam( MCH_MP.LICOMPLEN, dLiCompLength) if BD.TURN and bLioTang then EgtSetMachiningParam( MCH_MP.LEADOUTTYPE, MCH_MILL_LO.PERP_TG) end EgtSetMachiningParam( MCH_MP.LOTANG, dLoTang) EgtSetMachiningParam( MCH_MP.LOPERP, dLoPerp) + EgtSetMachiningParam( MCH_MP.LOCOMPLEN, dLoCompLength) -- imposto allungamenti iniziale e finale EgtSetMachiningParam( MCH_MP.STARTADDLEN, -dAccStart) EgtSetMachiningParam( MCH_MP.ENDADDLEN, -dAccEnd) @@ -157,6 +171,9 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD local vtOut = EgtIf( vtN:getX() > 0, X_AX(), -X_AX()) EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, 'perpendicular', b3Raw, vtTool, vtOut)) -- eventuali note + if ( sLeadInOutType == 'PerpendicularOutraw') then + sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3) + end if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo if not ML.ApplyMachining( true, false) then @@ -457,7 +474,17 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local bLioTang local Ktp = 1.1 if BD.KIOTP then Ktp = BD.KIOTP end - if ( ( sLeadInOutType == 'Tangent') or ( not bDownUp or abs( vtTg:getY()) > 0.5) and + if ( sLeadInOutType == 'PerpendicularOutraw') then + bLioTang = false + dLiCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLoCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiTang = 5 + dLoTang = 5 + dLiPerp = 0 + dLoPerp = 0 + dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp) + dLenLo = sqrt( dLoTang * dLoTang + dLoPerp * dLoPerp) + elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( not bDownUp or abs( vtTg:getY()) > 0.5) and ( not bDownHead or abs( vtTg:getZ()) < 0.51) and abs( vtTg:getX()) < 0.9848 and ( ( abs( vtTg:getZ()) < 0.17 and ( vtV1:getZ() < -0.5 or vtV2:getZ() < -0.5) and not bDownHead) or @@ -603,6 +630,9 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local sBlockedAxis = EgtIf( bMaximizeVerticalDepth, 'parallel', 'perpendicular') EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, BL.GetBlockedAxis( sCutting, sBlockedAxis, b3Raw, vtN, vtOrthO)) -- eventuali note + if ( sLeadInOutType == 'PerpendicularOutraw') then + sNotes = EgtSetValInNotes( sNotes, 'OutRaw', 3) + end if sNotes and #sNotes > 0 then EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) end -- eseguo if not ML.ApplyMachining( true, false) then diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 5ed660f..69275a7 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -597,8 +597,14 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b vtOrthoOAlternative = - vtOrthoO end local sLeadInOutTypeFbs = 'Calculated' - if ( sLeadInOutType == 'Tangent') and ( ( i % 2) ~= 0) then - sLeadInOutTypeFbs = 'Tangent' + if ( ( i % 2) ~= 0) then + if ( sLeadInOutType == 'Tangent') then + sLeadInOutTypeFbs = 'Tangent' + elseif ( sLeadInOutType == 'Perpendicular') then + sLeadInOutTypeFbs = 'Perpendicular' + elseif ( sLeadInOutType == 'PerpendicularOutraw') then + sLeadInOutTypeFbs = 'PerpendicularOutraw' + end end local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative) if not bOk then return bOk, sErr end diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 54faa75..f4ba79f 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -177,10 +177,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER and not BD.DOWN_HEAD then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end @@ -243,10 +240,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut for j = nHorizontalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end @@ -507,14 +501,12 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw) if not bOk then return bOk, sErr end -- tagli a cubetti con eventuale superficie limitante - bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf) + local sLeadInOutType = 'PerpendicularOutraw' + bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf, sLeadInOutType) end -- tagli aggiuntivi non necessari else - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nil, sLeadInOutType) end return bOk, sErr diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 4dae7ce..f2d82d0 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -352,10 +352,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER and not BD.DOWN_HEAD then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return bOk, sErr end end @@ -425,10 +422,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut for j = nHorizontalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType) if not bOk then return false, sErr end end @@ -784,10 +778,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt end -- tagli aggiuntivi non necessari else - local sLeadInOutType = 'Calculated' - if BD.PRESS_ROLLER then - sLeadInOutType = 'Tangent' - end + local sLeadInOutType = 'PerpendicularOutraw' bOk, sErr = Cut.Make( Proc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nil, sLeadInOutType) end if sNotesFinal then From 77310576bd7d1fac4b3271aa0e17c00eb44667aa Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 09:09:50 +0200 Subject: [PATCH 06/28] In LongDoubleCut, se taglio concavo rivolto verso il basso, gestione lavorazione con lama DownUp se macchina senza testa sotto --- LuaLibs/ProcessLongDoubleCut.lua | 33 ++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index 85d44a2..f64cc41 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -286,9 +286,11 @@ local function CalcBladeUse( bUseBlade, bDown_Head, nSide, vtN1, vtN2, bConvex, end end else - if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then - bCanUseBlade = true - end + --if ( vtN1 and vtN1:getZ() >= EgtIf( dCustomAngle, dCustomAngle, -0.5)) and ( not vtN2 or vtN2:getZ() >= -0.5) then + -- bCanUseBlade = true + --end + -- viene abilitata sempre lama da sotto + bCanUseBlade = true end end end @@ -423,12 +425,22 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- analisi del taglio local vOrd = {} local vFaceUse = {} + local bIsMachDownUp = false if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} elseif nSide == -1 then vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) - vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} + local vtFaceUse1, vtFaceUse2 + if bCanUseBlade and not BD.DOWN_HEAD then + bIsMachDownUp = true + vtFaceUse1 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[1] - ptM)) + vtFaceUse2 = BL.GetOrtupOpposite( BL.GetNearestOrthoOpposite( ptC[2] - ptM)) + else + vtFaceUse1 = BL.GetNearestParalOpposite( ptC[1] - ptM) + vtFaceUse2 = BL.GetNearestParalOpposite( ptC[2] - ptM) + end + vFaceUse = { vtFaceUse1, vtFaceUse2} else local bFront = ( ( vtN[1]:getY() + vtN[2]:getY()) < 0) if bFront then @@ -851,7 +863,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- imposto la direzione di lavoro per avere scarico del truciolo ottimale local nWorkSide, bInvert if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then - if bIsCurrentBladeCCW then + if bIsCurrentBladeCCW and not bIsMachDownUp then nWorkSide = MCH_MILL_WS.LEFT bInvert = true dSal, dEal = dEal, dSal @@ -860,7 +872,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster bInvert = false end else - if bIsCurrentBladeCCW then + if bIsCurrentBladeCCW and not bIsMachDownUp then nWorkSide = MCH_MILL_WS.LEFT bInvert = false else @@ -1067,6 +1079,11 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster if nSide == -1 and BD.DOWN_HEAD then EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) + elseif nSide == -1 and not BD.DOWN_HEAD and bIsMachDownUp then + EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( EgtGetMachiningParam( MCH_MP.INVERT), false, true)) + dOffset = 5 + EgtSetMachiningParam( MCH_MP.STARTADDLEN, dEal) + EgtSetMachiningParam( MCH_MP.ENDADDLEN, dSal) else EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEal) @@ -1368,7 +1385,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster --EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, BL.GetParallelOpposite( vFaceUse[vOrd[i]]), vFaceUse[vOrd[i]])) EgtSetMachiningParam( MCH_MP.FACEUSE, EgtIf( bSide, MCH_MILL_FU.PARAL_DOWN, vFaceUse[vOrd[i]])) -- imposto lato di lavoro e inversione - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bSide, true, false)) -- imposto offset radiale (nullo se concavo o di lato) local dOffsR = EgtIf( k < nO, ( nO - k) * dStep, EgtIf( bConvex, - BD.CUT_EXTRA, 0)) @@ -1804,7 +1821,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end -- imposto lato di lavoro e inversione - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bIsMachDownUp, MCH_MILL_WS.RIGHT, MCH_MILL_WS.LEFT)) EgtSetMachiningParam( MCH_MP.INVERT, true) -- calcolo la componente dNz non in base alla classificazione della feature (sopra, sotto, fianchi) ma alla componente maggiore -- local dNz = EgtIf( nSide == 0, vtN[vOrd[i]]:getY(), vtN[vOrd[i]]:getZ()) From 0c4f57a90b8f244ff78686ec91c8e758a0c0e240 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Jun 2025 11:59:42 +0200 Subject: [PATCH 07/28] - in ProcessSplit si fa attacco perpendicolare OutRaw anche per tutti i tagli con Cut.Make - in tagli testa e coda sistemata lunghezza compensazione per caso con OutRaw --- LuaLibs/FacesBySaw.lua | 14 +++++++------- LuaLibs/ProcessCut.lua | 2 +- LuaLibs/ProcessHeadCut.lua | 12 ++++++------ LuaLibs/ProcessSplit.lua | 15 ++++++++------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 623c369..0917745 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -46,7 +46,7 @@ local BD = require( 'BeamData') local ML = require( 'MachiningLib') --------------------------------------------------------------------- -function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType) +function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation) EgtOutLog( 'FacesBySaw.MakeParallelOne', 3) -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT) @@ -83,8 +83,8 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD if BD.KIOTP then Ktp = BD.KIOTP end if ( sLeadInOutType == 'PerpendicularOutraw') then bLioTang = false - dLiCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) - dLoCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) dLiTang = 5 dLoTang = 5 dLiPerp = 0 @@ -231,7 +231,7 @@ local function GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrthO) end --------------------------------------------------------------------- -function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, sLeadInOutType, Par5Alternative) +function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, bMaximizeVerticalDepth, bSpecialTangentLeadInOut, sLeadInOutType, Par5Alternative, dActualElevation) -- se lama con asse parallelo alla faccia, passo alla apposita funzione if ( Par5 == MCH_MILL_FU.PARAL_DOWN or Par5 == MCH_MILL_FU.PARAL_TOP or @@ -239,7 +239,7 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw Par5 == MCH_MILL_FU.PARAL_BACK or Par5 == MCH_MILL_FU.PARAL_LEFT or Par5 == MCH_MILL_FU.PARAL_RIGHT) then - return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType) + return MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDwnUp, dCutExtra, dCutSic, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw, bForceInvert, sLeadInOutType, dActualElevation) end -- la lama ha asse perpendicolare alla faccia EgtOutLog( 'FacesBySaw.MakeOne', 3) @@ -476,8 +476,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if BD.KIOTP then Ktp = BD.KIOTP end if ( sLeadInOutType == 'PerpendicularOutraw') then bLioTang = false - dLiCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) - dLoCompLength = BD.MAX_DIM_DICE - ( BD.DECR_VERT_CUT or 0) + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) dLiTang = 5 dLoTang = 5 dLiPerp = 0 diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 69275a7..46513ab 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -606,7 +606,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b sLeadInOutTypeFbs = 'PerpendicularOutraw' end end - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative) + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dMaxVertDepth) if not bOk then return bOk, sErr end end end diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index f4ba79f..85ac1f5 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -161,7 +161,7 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi -local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, dOffsetBetweenCuts) local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile @@ -178,7 +178,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j local sLeadInOutType = 'PerpendicularOutraw' - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end @@ -241,7 +241,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j local sLeadInOutType = 'PerpendicularOutraw' - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end -- se necessario taglio verticale doppio, eseguo l'opposto @@ -284,7 +284,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local dCutOffset = ( i - 1) * dOffsetBetweenCuts -- se trave larga effettuo tagli verticali aggiuntivi if HeadCutType.bNeedVerticalAddedCuts then - local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end if i == 1 and HeadCutType.sType =='Precut' then @@ -340,7 +340,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut end -- se trave larga effettuo tagli verticali aggiuntivi if HeadCutType.bNeedVerticalAddedCuts then - local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) @@ -498,7 +498,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if AreSameVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end end -- tagli verticali - bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw) + bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, dOffsL) if not bOk then return bOk, sErr end -- tagli a cubetti con eventuale superficie limitante local sLeadInOutType = 'PerpendicularOutraw' diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index f2d82d0..d50cbca 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -336,7 +336,7 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi -local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes, dOffsetBetweenCuts) local nVerticalCuts = ceil( Proc.Face[1].WidthTrimmed / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = Proc.Face[1].WidthTrimmed / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile @@ -353,7 +353,7 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j local sLeadInOutType = 'PerpendicularOutraw' - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType) + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end @@ -423,7 +423,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut local nFaceUse = MCH_MILL_FU.PARAL_DOWN local dHorizontalCutOffset = dHorizontalSliceHeight * -j local sLeadInOutType = 'PerpendicularOutraw' - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType) + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0 , Cutting1Data.sCutting, Cutting1Data.dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, sLeadInOutType, nil, dOffsetBetweenCuts) if not bOk then return false, sErr end end -- se necessario taglio verticale doppio, eseguo l'opposto @@ -472,7 +472,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut -- se trave larga effettuo tagli verticali aggiuntivi if TailCutType.bNeedVerticalAddedCuts then local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes) + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end if i == 1 and TailCutType.sType =='Precut' then @@ -541,7 +541,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut -- se trave larga effettuo tagli verticali aggiuntivi if TailCutType.bNeedVerticalAddedCuts then local sSpecNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes) + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes, dOffsetBetweenCuts) if not bOk then return bOk, sErr end end local sNotes @@ -771,10 +771,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if AreOppositeVectorApprox( X_AX(), vtNLimitingSurf) then EgtInvertSurf( nLimitingSurf) end end -- tagli verticali - bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes) + bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes, dOffsL) if not bOk then return bOk, sErr end -- tagli a cubetti con eventuale superficie limitante - bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf) + local sLeadInOutType = 'PerpendicularOutraw' + bOk, sErr = Cut.Make( AddProc, nNewPhase, nRawId, nPartId, dMaxElev, nil, false, true, b3Raw, sNotes, dCurrOvmT, nil, nLimitingSurf, sLeadInOutType) end -- tagli aggiuntivi non necessari else From 8e19e87d3f9172a7b4fef5102a6958c7f2f28f6d Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 12:15:45 +0200 Subject: [PATCH 08/28] 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 eabbc883e4b07cdc973855f9ddd2db16836f97d8 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Jun 2025 12:38:04 +0200 Subject: [PATCH 09/28] - in DiceCut.GetDice si ritornano anche gli OffsetP e OffsetO utilizzati - in ProcessCut si usano gli offset reali dei cubetti per il calcolo della lunghezza di compensazione per gli attacchi perpendicolari OutRaw --- LuaLibs/DiceCut.lua | 2 +- LuaLibs/ProcessCut.lua | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index a91a07f..183fa66 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -566,7 +566,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl end end - return UltimateTable + return UltimateTable, OffsetP, OffsetO end ---------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 46513ab..62fff86 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -377,6 +377,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- se lungo, una faccia e rivolto sul retro verso l'alto si forzano i cubetti per evitare di rovinare il pezzo successivo local bForceDicing = ( Proc.Fct == 1 and Proc.AffectedFaces.Left and bLongCut and vtN:getZ() > 10 * GEO.EPS_SMALL and vtN:getY() < 10 * GEO.EPS_SMALL) local vCuts = {} + local dDicingOffsetP + local dDicingOffsetO if ( ( not Proc.AdvTail) or bForceDicing) and ( dCutH > dMaxDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC or dCutV > dMaxVertDepth - BD.CUT_EXTRA - 3 * BD.COLL_SIC) then local ptExtra, vtExtra local bAutoCalcSurf = true @@ -424,10 +426,10 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b end -- se il taglio è più spesso della lama abilito il dicing, altrimenti no if ( dMaxElev > dSawThick) or bForceDicing then - vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) + vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate if ( bFillTail or bCustDiceCut) and #vCuts == 0 then - vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) + vCuts, dDicingOffsetP = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) end end end @@ -606,7 +608,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b sLeadInOutTypeFbs = 'PerpendicularOutraw' end end - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dMaxVertDepth) + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw, nil, nil, bSpecialTangentLeadInOut, sLeadInOutTypeFbs, vtOrthoOAlternative, dDicingOffsetP) if not bOk then return bOk, sErr end end end From e98f9246303f112b26ae547d8f488d555152904e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Jun 2025 14:41:57 +0200 Subject: [PATCH 10/28] - in FacesBySaw piccola correzione alla distanza di compensazione in caso di attacco perpendicolare con OutRaw --- LuaLibs/FacesBySaw.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 0917745..f47156f 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -83,8 +83,8 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD if BD.KIOTP then Ktp = BD.KIOTP end if ( sLeadInOutType == 'PerpendicularOutraw') then bLioTang = false - dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) - dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra + dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra dLiTang = 5 dLoTang = 5 dLiPerp = 0 @@ -476,8 +476,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw if BD.KIOTP then Ktp = BD.KIOTP end if ( sLeadInOutType == 'PerpendicularOutraw') then bLioTang = false - dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) - dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra + dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra dLiTang = 5 dLoTang = 5 dLiPerp = 0 From 9480453e5796dff801eccb08880f6f48ea015a4a Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 23 Jun 2025 14:53:33 +0200 Subject: [PATCH 11/28] 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 12/28] 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 13/28] 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 21fe8ca47d3a3bf41d39cc2e06ec28a85499d365 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Jun 2025 16:58:49 +0200 Subject: [PATCH 14/28] - in FacesBySaw piccola correzione alla distanza tangente in caso di attacco perpendicolare con OutRaw --- LuaLibs/FacesBySaw.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index f47156f..3c8e4b2 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -85,8 +85,8 @@ function MakeParallelOne( nSurfId, nFacet, sCutting, dSawDiam, nFaceUse, dVzLimD bLioTang = false dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra - dLiTang = 5 - dLoTang = 5 + dLiTang = 1 + dLoTang = 1 dLiPerp = 0 dLoPerp = 0 elseif ( sLeadInOutType ~= 'Perpendicular') and ( ( sLeadInOutType == 'Tangent') or ( Ktp * dLi2Tang < dLiPerp)) then @@ -478,8 +478,8 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw bLioTang = false dLiCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra dLoCompLength = dActualElevation + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + dCutExtra - dLiTang = 5 - dLoTang = 5 + dLiTang = 1 + dLoTang = 1 dLiPerp = 0 dLoPerp = 0 dLenLi = sqrt( dLiTang * dLiTang + dLiPerp * dLiPerp) From 5de62b9563db186f7be1fe4c957a56d665d65884 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 23 Jun 2025 17:05:29 +0200 Subject: [PATCH 15/28] update versione minima --- Version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version.lua b/Version.lua index a3359a8..446f312 100644 --- a/Version.lua +++ b/Version.lua @@ -3,4 +3,4 @@ NAME = 'Beam' VERSION = '2.7f3' -MIN_EXE = '2.6e5' +MIN_EXE = '2.7f2' From 73c86bd35f93b8c71fb9d74bcffcbff8ff6b216b Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 24 Jun 2025 10:32:37 +0200 Subject: [PATCH 16/28] =?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 17/28] 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 18/28] 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 19/28] - 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 20/28] =?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 21/28] - 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 22/28] - 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 From cac9ec767c0d6656351879d7e03899dfaa600974 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Thu, 26 Jun 2025 17:30:21 +0200 Subject: [PATCH 23/28] Prima versione finitura con fresa piccola su profilo caudato --- LuaLibs/MachiningLib.lua | 4 +- LuaLibs/ProcessProfCamb.lua | 95 +++++++++++++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 10 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 768a9fd..098bf49 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -501,8 +501,8 @@ function MachiningLib.FindAngleDrilling( dDiam, dDepth, bTopHead, bDownHead) end --------------------------------------------------------------------- -function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3) - return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3) +function MachiningLib.FindMilling( sType, dDepth, sTuuidMstr, dMaxDiam, dMaxTotLen, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) + return FindMachining( MCH_MY.MILLING, sType, { Depth = dDepth, TuuidMstr = sTuuidMstr, MaxDiam = dMaxDiam, MaxTotLen = dMaxTotLen}, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) end --------------------------------------------------------------------- diff --git a/LuaLibs/ProcessProfCamb.lua b/LuaLibs/ProcessProfCamb.lua index b2f8a72..1778090 100644 --- a/LuaLibs/ProcessProfCamb.lua +++ b/LuaLibs/ProcessProfCamb.lua @@ -33,6 +33,7 @@ local sEnableExtraBladeUpperFace = 'Q02' -- i local sDepthChamferMill = 'Q03' -- d local sOverMaterialForFinish = 'Q04' -- d local sPreemptiveChamfer = 'Q05' -- i +local bUseSmallMill = 'Q06' -- i -- abilitazioni extra local dMakeAntiSplintOnHead = 1 -- valore impronta antischeggia, per disattivare settare = nil o = 0 @@ -206,6 +207,41 @@ local function VerifyCham( Proc, AuxId, nRawId, bMakeVertCham, sDephtCham, sOnly return nChamfer, dDepth, sMilling, sMilling2 end +--------------------------------------------------------------------- +function VerifySmallMillCanFinish( dDiamCurrentTool, dDepthProfile, nSide) + local dToolMaxDepthSmall, dToolDiamSmall + -- abilitazione lavorazione da sotto + local sMillType = 'Prof' + local sMillingSmall, _, _, bH2Small = ML.FindMilling( sMillType, nil, nil, nil, nil, true, nil, nil, nil, 'Smallest') + if not sMillingSmall then + return false + end + -- Recupero i dati dell'utensile + if EgtMdbSetCurrMachining( sMillingSmall) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid)) then + dToolMaxDepthSmall = EgtTdbGetCurrToolMaxDepth() + dToolDiamSmall = EgtTdbGetCurrToolParam( MCH_TP.DIAM) + -- se non ci sono almeno 5mm di differenza si fa con utensile standard + if dDiamCurrentTool - 5 < dToolDiamSmall then + return false + end + end + else + return false + end + local bDouble = ( dDepthProfile + BD.CUT_EXTRA > dToolMaxDepthSmall) + -- se lavorazione in doppio richiesta, si verifica se richiesta testa sotto + if bDouble and nSide == 0 then + return false -- TODO macchine con BD.DOWN_HEAD potrebbero lavorare in doppio in questo caso! + end + + if not bDouble or ( dDepthProfile + BD.MILL_OVERLAP < dToolMaxDepthSmall * 2) then + return true, sMillingSmall, bDouble + end + return false +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) @@ -244,7 +280,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) if vtN:getZ() > 0.1 then nSide = 1 elseif vtN:getZ() < -0.1 then - nSide = -1 + nSide = -1 end -- abilitazione lavorazione da sotto local bMillDown = ( BD.DOWN_HEAD and nSide == -1) @@ -468,6 +504,15 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end end end + + + local bUseSmallMillOnFinish = EgtGetInfo( Proc.Id, bUseSmallMill, 'i') == 1 + local sMillingSmall, bDoubleSmall + -- se serve fresa più piccola per finitura + if bUseSmallMillOnFinish then + bUseSmallMillOnFinish, sMillingSmall, bDoubleSmall = VerifySmallMillCanFinish( dMillDiam, dProfDepth, nSide) + end + -- se il chamfer non è esclusivo continuo con le altre lavorazioni if nChamfer < 2 then -- verifico se necessario lavorare in doppio @@ -477,7 +522,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local sMillingDown if bDouble then if nSide == 0 then - if BD.DOWN_HEAD then + if BD.DOWN_HEAD then -- recupero la lavorazione sMillingDown = ML.FindMilling( 'Prof_H2', nil, nil, nil, nil, false, true) if not sMillingDown then @@ -537,10 +582,6 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) bFinish = true end - -- se parametro sovramateriale è maggiore di 0 lo aggiungo al sovramateriale precedente - if dOffsetPar > 0 then - EgtSetMachiningParam( MCH_MP.OFFSR, ( dOriOffset + dOffsetPar)) - end -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() @@ -567,7 +608,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) nMchId = nMch2Id end -- se abilitata, aggiungo lavorazione di finitura - if bFinish then + if bFinish and not bUseSmallMillOnFinish then -- inserisco la lavorazione local sNewName = 'ProfB_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) @@ -682,7 +723,7 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) nMchId = nMch2Id end -- se abilitata, aggiungo lavorazione di finitura - if bFinish then + if bFinish and not bUseSmallMillOnFinish then -- inserisco la lavorazione local sNewName = 'Prof_Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) @@ -738,6 +779,44 @@ function ProcessProfCamb.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end end + -- se finitura con fresa piccola + if bFinish and bUseSmallMillOnFinish then + local sDepthSmall = EgtIf( bDoubleSmall, ( dProfDepth+ BD.MILL_OVERLAP ) / 2, dProfDepth + BD.CUT_EXTRA) + local sMachName = 'Fin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + nMchId = EgtAddMachining( sMachName, sMillingSmall) + if not nMchId then + local sErr = 'Error adding machining ' .. sMachName .. '-' .. sMillingSmall + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ AuxId, -1}}) + + -- imposto l'affondamento + EgtSetMachiningParam( MCH_MP.DEPTH, sDepthSmall) + -- posizione braccio porta testa + EgtSetMachiningParam( MCH_MP.SCC, EgtIf( bHead, MCH_SCC.ADIR_XP, MCH_SCC.ADIR_XM)) + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + end + + if bDoubleSmall then + local sNewName = 'FinB_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local nMch2Id = EgtCopyMachining( sNewName, EgtGetName( nMchId)) + EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) + EgtSetMachiningParam( MCH_MP.INVERT, true) + + -- eseguo + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchId, false) + return false, sErr + end + end + end end -- aggiorno ingombro testa o coda per presa if nSide ~= 1 then -- se feature di fianco o da sotto From a996d4beb34569558b83b4c5d2c7e15ca70827fa Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 30 Jun 2025 16:13:19 +0200 Subject: [PATCH 24/28] - in LapJoint correzioni a sega a catena con attacco laterale --- LuaLibs/BeamLib.lua | 21 +++++++++++++++++++++ LuaLibs/ProcessLapJoint.lua | 19 +++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 1d66881..72188fb 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -899,6 +899,27 @@ function BeamLib.FindFaceBestOrientedAsAxis( Proc, vtAx, fctExclude) return nFaceIndMax, ptC, vtN end +--------------------------------------------------------------------- +function BeamLib.GetEdgeToMachineFromVector( nSurfId, nFacet, vtOrtho) + local _, EdgesEgt = EgtSurfTmGetFacetOutlineInfo( nSurfId, nFacet, GDB_ID.ROOT) + + local nEdgeIndMax = 0 + local dMaxComp = - GEO.INFINITO + for i = 1, #EdgesEgt do + local vtN = EdgesEgt[i].Norm + if EdgesEgt[i].Open then + vtN = -vtN + end + local dComp = vtN * vtOrtho + if dComp > dMaxComp then + nEdgeIndMax = i -1 + dMaxComp = dComp + end + end + + return nEdgeIndMax +end + --------------------------------------------------------------------- function BeamLib.GetTunnelDimension( Proc, nPartId) -- sono necessarie almeno due facce diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 56de528..a932c2e 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3224,6 +3224,8 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, vtRef = -Z_AX() nFaceZ = BL.FindFaceBestOrientedAsAxis( Proc, -Z_AX()) end + else + nFaceZ = nFacInd end dDepth = Proc.Face[ nFaceZ + 1].Elevation end @@ -3284,12 +3286,21 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, EgtOutLog( sWarn) end EgtSetMachiningParam( MCH_MP.DEPTH, dMachiningDepth) - local dStartAddLen = dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ) - local dEndAddLen = - dSawWidth / 2 - if vtRef:getZ() > 10 * GEO.EPS_SMALL then + -- si decidono lato di lavoro, inversione e estensione in base al lato aperto + local nEdgeIndex = BL.GetEdgeToMachineFromVector( Proc.Id, nFacAdj, vtRef) + local EdgesEgt = BL.GetEdgesInfo( Proc, Proc.Face[nFacAdj+1]) + local CurrentEdge = EdgesEgt[nEdgeIndex+1] + local dStartAddLen = 0 + local dEndAddLen = 0 + if CurrentEdge.IsStartOpen then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MORTISE_WS.RIGHT) + EgtSetMachiningParam( MCH_MP.INVERT, false) + else EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MORTISE_WS.LEFT) EgtSetMachiningParam( MCH_MP.INVERT, true) end + dStartAddLen = dSawWidth / 2 + EgtMdbGetGeneralParam( MCH_GP.SAFEZ) + EgtMdbGetGeneralParam( MCH_GP.SAFEAGGRBOTTZ) + dEndAddLen = - dSawWidth / 2 EgtSetMachiningParam( MCH_MP.STARTADDLEN, dStartAddLen) EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) end @@ -3299,7 +3310,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local dMachiningStep = EgtGetMachiningParam( MCH_MP.STEP) or 0 -- TODO qui sostituire con valore preciso da GetSetupInfo if BD.C_SIMM then - dMachiningStep = 165 + dMachiningStep = 175 if vtRef:getZ() < - 10 * GEO.EPS_SMALL then dMachiningStep = 250 end From ea64a9a3f4a1269cc0115f9ae34a578c18fd7dec Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Mon, 30 Jun 2025 17:39:18 +0200 Subject: [PATCH 25/28] =?UTF-8?q?In=20FindMachining,=20se=20c'=C3=A8=20un?= =?UTF-8?q?=20criterio=20di=20selezione=20utensile,=20allora=20non=20si=20?= =?UTF-8?q?ottimizzano=20le=20teste.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/MachiningLib.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/LuaLibs/MachiningLib.lua b/LuaLibs/MachiningLib.lua index 098bf49..167e9cb 100644 --- a/LuaLibs/MachiningLib.lua +++ b/LuaLibs/MachiningLib.lua @@ -331,6 +331,7 @@ end --------------------------------------------------------------------- local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, bExcludeH2, bExcludeH3, sSortingCriterion) + local bOptimizeHeads = BEAM and BEAM.BW and ( not sSortingCriterion or sSortingCriterion == '') if bTopHead == nil and bDownHead == nil then bTopHead = true bDownHead = false @@ -368,15 +369,15 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, ForEnd = 1 ForStep = -1 end - if ( BEAM and BEAM.BW) or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then + if bOptimizeHeads or MachineHeadType == ONE_HEAD or MachineHeadType == TWO_EQUAL_HEADS or ( MachineHeadType == TWO_UP_DOWN_HEADS and not bDownHead) then _, sType = EgtEndsWith( sType, '_H2') - elseif not ( BEAM and BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then + elseif not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and not bTopHead and bDownHead then if not EgtEndsWith( sType, '_H2') then sType = sType .. '_H2' end end local MachineHeadUse = MachineHeadType - if not ( BEAM and BEAM.BW) and MachineHeadUse == TWO_EQUAL_HEADS then + if not bOptimizeHeads and MachineHeadUse == TWO_EQUAL_HEADS then MachineHeadUse = ONE_HEAD end if MachineHeadUse == TWO_UP_DOWN_HEADS and bTopHead and bDownHead then @@ -388,7 +389,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, for i = ForStart, ForEnd, ForStep do local Machining = Machinings[i] local sMachiningType = Machining.Type - if ( BEAM and BEAM.BW) or MachineHeadUse == TWO_EQUAL_HEADS then + if bOptimizeHeads or MachineHeadUse == TWO_EQUAL_HEADS then _, sMachiningType = EgtEndsWith( Machining.Type, '_H2') end -- recupero dati utensile @@ -464,7 +465,7 @@ local function FindMachining( MachiningType, sType, Params, bTopHead, bDownHead, end end local bH2, sOrigType = EgtEndsWith( sType, '_H2') - if ( not BEAM or not BEAM.BW) and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then + if not bOptimizeHeads and MachineHeadType == TWO_UP_DOWN_HEADS and bH2 and bTopHead then return FindMachining( MachiningType, sOrigType, Params, true, false) end end From aba4ebecc45019fed4e6de8b0343e3a65a8e83fc Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 2 Jul 2025 09:51:25 +0200 Subject: [PATCH 26/28] - in LapJoint per sega a catena con attacco laterale step minimo da sotto portato a 260 per macchine tipo PF --- LuaLibs/ProcessLapJoint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a932c2e..2c3c8c1 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3312,7 +3312,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, if BD.C_SIMM then dMachiningStep = 175 if vtRef:getZ() < - 10 * GEO.EPS_SMALL then - dMachiningStep = 250 + dMachiningStep = 260 end end local dActualStep = ( dMachiningDepth - dMachiningStep) / ( 2 + 1) From 010e1421c71fc60391128188a86141ee8dd5f956 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 8 Jul 2025 15:24:34 +0200 Subject: [PATCH 27/28] =?UTF-8?q?-=20in=20LapJoint,=20attacco=20laterale?= =?UTF-8?q?=20con=20sega=20a=20catena=20temporaneamente=20disabilitato,=20?= =?UTF-8?q?finch=C3=A8=20non=20si=20risolvono=20i=20problemi=20di=20movime?= =?UTF-8?q?ntazione=20in=20macchina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLapJoint.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 2c3c8c1..298cde5 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -192,7 +192,8 @@ local function AssignQIdent( Proc) Q_STAIRCASE = '' Q_SAW_PLUS_CHAIN = 'Q11' Q_FORCE_CHAINSAW = 'Q12' - Q_NO_ROTATION = 'Q13' + -- TODO da riportare a Q13 quando è sistemata la gestione del movimento in macchina nell'attacco laterale + Q_CHAINSAW_FROM_SIDE = 'Q999' if ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 16 then Q_FORCE_BLADE = 'Q01' -- i @@ -967,7 +968,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) end end - local bNoRotation = ( EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') or 0) == 1 + local bNoRotation = ( EgtGetInfo( Proc.Id, Q_CHAINSAW_FROM_SIDE, 'i') or 0) == 1 if bDown and bNoRotation then bDown = false end @@ -3094,7 +3095,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, return false, sErr end local bGoFromHead = true - local bAttackFromSide = ( ( EgtGetInfo( Proc.Id, Q_NO_ROTATION, 'i') or 0) == 1) + local bAttackFromSide = ( ( EgtGetInfo( Proc.Id, Q_CHAINSAW_FROM_SIDE, '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 From 5db475bcf718564d7e25b343b979c5b78756b4be Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 8 Jul 2025 18:10:42 +0200 Subject: [PATCH 28/28] update version e log --- UpdateLog.txt | 11 ++++++++++- Version.lua | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/UpdateLog.txt b/UpdateLog.txt index a74a82a..c65cc68 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,7 +1,16 @@ ==== Beam Update Log ==== +Versione 2.7g1 (08/07/2025) +- Added : in LapJoint, aggiunti smussi anche se lavorazione con truciolatore +- Added : per profilo caudato aggiunta finitura con fresa piccola +- Added : gestione tastatura +- Modif : nei tagli di testa e coda, compresi quelli di spezzatura, la lama evita di arretrare se non necessario +- Modif : in LongDoubleCut migliorie varie +- Modif : in RidgeLap migliorie varie +- Modif : nelle forature che attraversano un taglio ora si considera la profondità già lavorata + Versione 2.7f3 (19/06/2025) -- Modifx : in StepJointNotch corretta distanza attacco in/out +- Modif : in StepJointNotch corretta distanza attacco in/out Versione 2.7f2 (18/06/2025) - Modif : in LongDoubleCut aggiunto messaggio feature non completa se utensile non arriva sul fondo diff --git a/Version.lua b/Version.lua index 446f312..72baa7a 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.7f3' +VERSION = '2.7g1' MIN_EXE = '2.7f2'