From 5c82ab27c8fe58ed01dc78488c520e981b2118a3 Mon Sep 17 00:00:00 2001 From: "daniele.nicoli" Date: Wed, 8 Apr 2026 17:10:25 +0200 Subject: [PATCH 1/5] =?UTF-8?q?ProcessStepJoint=20-=20Aggiunta=20possibili?= =?UTF-8?q?t=C3=A0=20di=20forzare=20lavorazione=20con=20fresa=20in=20caso?= =?UTF-8?q?=20di=20feature=20a=202=20facce=20concava=20con=20angolo=20tra?= =?UTF-8?q?=20le=20facce=20>=2090=C2=B0.=20Q02=3D1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessStepJoint.lua | 188 ++++++++++++++++++++++++++++------- 1 file changed, 154 insertions(+), 34 deletions(-) diff --git a/LuaLibs/ProcessStepJoint.lua b/LuaLibs/ProcessStepJoint.lua index 88c0780..cc9bc6c 100644 --- a/LuaLibs/ProcessStepJoint.lua +++ b/LuaLibs/ProcessStepJoint.lua @@ -140,6 +140,112 @@ local function MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) return true end +--------------------------------------------------------------------- +local function MakePocket( Proc, nPartId, ptPs, vtN, nFaceRef, nDiffWidth, sMchFind, nUseRoughTool, tBHx) + + -- calcolo il elevazione dal punto medio + local dElev + local dLenIn, dLedOut = BL.GetPointDirDepth( nPartId, ptPs, vtN[nFaceRef]) + if dLenIn > 0 then + dElev = dLenIn + elseif dLedOut then + dElev = dLedOut + end + local dCollSic = 2 * BD.COLL_SIC + local sTuuidMstr + -- calcolo il diametro utensile + local dDiamTool + if nUseRoughTool == 1 then + -- se feature passante prendo utensile più grande possibile + if ( Proc.AffectedFaces.Top and Proc.AffectedFaces.Bottom) or ( Proc.AffectedFaces.Front and Proc.AffectedFaces.Back) then + dDiamTool = nil + else + dDiamTool = max( 80, min( tBHx[nFaceRef][1], tBHx[nFaceRef][2])) + end + else + -- se non uso truciolatore prendo il valore dalle dimensioni minime delle facce + dDiamTool = min( tBHx[nFaceRef][1], tBHx[nFaceRef][2]) + end + -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -30deg) + local bTopHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() > -0.1) + local bDownHead = ( BD.DOWN_HEAD and vtN[nFaceRef]:getZ() < 0.1) + -- recupero la lavorazione + local sPocketing, _, _, bDownHead = ML.FindPocketing( sMchFind.. EgtIf( bDownHead, '_H2', ''), dDiamTool, dElev + dCollSic, nil, bTopHead, bDownHead) + if not sPocketing then + local sErr = 'Error : pocketing not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- recupero il diametro dell'utensile + if EgtMdbSetCurrMachining( sPocketing) then + sTuuidMstr = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidMstr) or '') then + dDiamTool = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dDiamTool + end + end + -- inserisco la lavorazione di svuotatura + local sName = 'Pock_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. 'F' .. tostring( nFaceRef - 1) + local nMchFId = EgtAddMachining( sName, sPocketing) + if not nMchFId then + local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing + EgtOutLog( sErr) + return false, sErr + end + -- aggiungo geometria + EgtSetMachiningGeometry( {{ Proc.Id, (nFaceRef-1)}}) + -- imposto uso faccia + EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.ORTHO_CONT) + -- imposto posizione braccio porta testa + if vtN[nFaceRef]:getY() < GEO.EPS_SMALL then + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM) + else + EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP) + end + -- La tasca ha sempre almeno un lato aperto, imposto opportuno attacco + EgtSetMachiningParam( MCH_MP.SUBTYPE, MCH_POCK_SUB.SPIRALIN) + -- imposto elevazione + local sUserNotes = EgtGetMachiningParam( MCH_MP.USERNOTES) or '' + sUserNotes = EgtSetValInNotes( sUserNotes, 'MaxElev', EgtNumToString( dElev, 1)) + EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes) + if not ML.ApplyMachining( true, false) then + -- provo ad allargare leggermente la tasca + EgtSetMachiningParam( MCH_MP.OFFSR, -0.1) + if not ML.ApplyMachining( true, false) then + local _, sErr = EgtGetLastMachMgrError() + EgtSetOperationMode( nMchFId, false) + return false, sErr + end + end + return true, '', sTuuidMstr +end + +--------------------------------------------------------------------- +local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, nDiffWidth, nUseRoughTool, dAng) + + local sMchFind = 'Pocket' + -- se feature é larga come trave imposto openpocket + if nDiffWidth == 0 then + sMchFind = 'OpenPocket' + -- altrimenti se non è passante disabilito il truciolatore + else + nUseRoughTool = 0 + end + -- applico la svuotatura + local bOk, sErr, sTuuidMstr = MakePocket( Proc, nPartId, ptPs, vtN, nBigInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx) + if not bOk then + return bOk, sErr + end + -- se angolo tra le facce maggiore di 90, inserisco la contornatura o svuotatura del lato più corto + if dAng > -90 then + -- applico la svuotatura + local bOk, sErr = MakePocket( Proc, nPartId, ptPs, vtN, nSmaInd, nDiffWidth, sMchFind, nUseRoughTool, tBHx) + if not bOk then + return bOk, sErr + end + end + return true +end + --------------------------------------------------------------------- -- Applicazione della lavorazione al caso due facce local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) @@ -156,6 +262,7 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) return false, sErr end -- dati delle facce + local tBHx = {} local ptC = {} local vtN = {} ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) @@ -183,11 +290,13 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero i dati dell'utensile local dSawDiam = 400 + local dSawThick = 2 local dMaxDepth = 0 if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end @@ -239,47 +348,58 @@ local function MakeTwoFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) vtRef[2] = vtN[2] ^ vtTg if vtRef[2] * vtN[1] < 0 then vtRef[2] = - vtRef[2] end -- determino quale faccia è più grande - local _, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0) - local _, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1) + local rfFac1, dB1, dH1 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0) + local rfFac2, dB2, dH2 = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 1) local nBigInd = EgtIf( dB1 * dH1 >= dB2 * dH2, 1, 2) local nSmaInd = 3 - nBigInd - -- calcolo extra taglio - local dCutExtra = dExtraUp - if dAng < -90.5 and dAng > -179.5 then - dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp - end - -- verifico se necessari tagli supplementari - local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) - --DC.PrintOrderCut( vCuts) - if #vCuts > 0 then - -- sistemo posizione nel DB e nome - for i = 1, #vCuts do - for j = 1, #vCuts[i] do - EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) - EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) - end - end - -- eseguo - for i = 1, #vCuts do - -- assegno il modo di tagliare - local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd]) - -- lavoro la faccia - for j = 1, #vCuts[i] do - local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra) - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOk then - return bOk, sErr - end - end - end - -- altrimenti, tagli diretti delle facce - else - local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide')) + tBHx[1] = {dH1, dV1, rfFac1} + tBHx[2] = {dH2, dV2, rfFac2} + local nUseRoughTool = EgtGetInfo( Proc.Id, 'Q02', 'i') + if nUseRoughTool == 1 and dAng < -0.1 and dAng > -90 then + local bOk, sErr = MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, ptC, vtN, nBigInd, nSmaInd, ptPs, tBHx, b3Raw, 0, nUseRoughTool, dAng) if not bOk then return bOk, sErr end + else + -- calcolo extra taglio + local dCutExtra = dExtraUp + if dAng < -90.5 and dAng > -179.5 then + dCutExtra = - dSawThick / tan( 180 + dAng) + dExtraUp + end + -- verifico se necessari tagli supplementari + local vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[nBigInd], vtN[nBigInd], false, ptC[nSmaInd], vtN[nSmaInd]) + --DC.PrintOrderCut( vCuts) + if #vCuts > 0 then + -- sistemo posizione nel DB e nome + for i = 1, #vCuts do + for j = 1, #vCuts[i] do + EgtSetName( vCuts[i][j], 'AddCut_' .. tostring( Proc.Id)) + EgtSetInfo( vCuts[i][j], 'TASKID', Proc.TaskId) + end + end + -- eseguo + for i = 1, #vCuts do + -- assegno il modo di tagliare + local vtOrthO = EgtIf( ( i % 2) == 1, vtRef[nSmaInd], vtRef[nBigInd]) + -- lavoro la faccia + for j = 1, #vCuts[i] do + local dLocCutExtra = EgtIf( j == #vCuts[i], dCutExtra - dExtraUp, dCutExtra) + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthO, nil, dLocCutExtra, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOk then + return bOk, sErr + end + end + end + -- altrimenti, tagli diretti delle facce + else + local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide')) + if not bOk then + return bOk, sErr + end + end end end + -- eventuale segnalazione ingombro di testa o coda if Proc.Head then local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() From a9ec6744e3cb0a5f470cee3a4cbbedac41706f9e Mon Sep 17 00:00:00 2001 From: "daniele.nicoli" Date: Thu, 9 Apr 2026 11:30:23 +0200 Subject: [PATCH 2/5] In DtMortise - Aggiunto parametro Q01=1 per non eseguire l'antischeggia --- LuaLibs/ProcessDtMortise.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index a38a4d9..36e71fb 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -231,7 +231,8 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local dAltMort = b3DtMrt:getDimZ() -- verifico se di tipo pocket local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) - if bPocket then bMakeAntiSplitPath = false end + local dForcePrecutBypass = EgtGetInfo( Proc.Id, 'Q01', 'i') + if bPocket or dForcePrecutBypass == 1 then bMakeAntiSplitPath = false end -- verifico se frontale local bFront = ( Proc.Prc == 56) -- se mortasa di fronte, eseguo il taglio della faccia From 66013f5e076e8418943fe0cc49965131f377a7e1 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 9 Apr 2026 16:36:20 +0200 Subject: [PATCH 3/5] - in ProcessLapJoint MakePathsOnExtremePoints si costruisce il percorso solo per i punti sui bordi del grezzo --- LuaLibs/BeamLib.lua | 25 +++++++++++++++++++++++++ LuaLibs/ProcessLapJoint.lua | 27 ++++++++++++++++----------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 5b39da5..0c19524 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1158,6 +1158,31 @@ function BeamLib.Is3EdgesApprox( Proc, nFacet, nAddGrpId) return bResult end +------------------------------------------------------------------------------------------------------------- +function BeamLib.IsPointOnBoxLimits( ptPoint, b3Solid) + local dTol = 500 * GEO.EPS_SMALL + + local dMinX = b3Solid:getMin():getX() + local dMinY = b3Solid:getMin():getY() + local dMinZ = b3Solid:getMin():getZ() + + local dMaxX = b3Solid:getMax():getX() + local dMaxY = b3Solid:getMax():getY() + local dMaxZ = b3Solid:getMax():getZ() + + -- Check di ogni piano limite + if abs( ptPoint:getX() - dMinX) < dTol then return true, "Left" end + if abs( ptPoint:getX() - dMaxX) < dTol then return true, "Right" end + + if abs( ptPoint:getY() - dMinY) < dTol then return true, "Front" end + if abs( ptPoint:getY() - dMaxY) < dTol then return true, "Back" end + + if abs( ptPoint:getZ() - dMinZ) < dTol then return true, "Bottom" end + if abs( ptPoint:getZ() - dMaxZ) < dTol then return true, "Top" end + + return false +end + ------------------------------------------------------------------------------------------------------------- -- restituisce le facce della parte interessate dalla feature Proc function BeamLib.GetProcessAffectedFaces( Proc) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index ec49024..b3af308 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -4803,7 +4803,7 @@ local function ManageAntiSplintBySaw( Proc, b3Raw, b3Solid, bIsU, vtN, nFacInd, end --------------------------------------------------------------------- -local function MakePathsOnExtremPoints( nAddGrpId, nIdPath, pPaths, dTDiam) +local function MakePathsOnExtremePoints( nAddGrpId, nIdPath, pPaths, dTDiam, b3Solid) local dLength = 2 if not nIdPath then return pPaths end @@ -4819,15 +4819,20 @@ local function MakePathsOnExtremPoints( nAddGrpId, nIdPath, pPaths, dTDiam) local vtIni = EgtSV( nIdPath, GDB_RT.GLOB) local vtEnd = EgtEV( nIdPath, GDB_RT.GLOB) - local ptIniP = ptIni - local ptEndP = ptIniP + (vtIni * dLength) - local nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB) - table.insert( pPaths, { nAuxId, 1, ptIniP}) + -- si costruisce il percorso solo per i punti sui bordi del grezzo + if BL.IsPointOnBoxLimits( ptIni, b3Solid) then + local ptIniP = ptIni + local ptEndP = ptIniP + (vtIni * dLength) + local nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB) + table.insert( pPaths, { nAuxId, 1, ptIniP}) + end - ptIniP = ptEnd - ptEndP = ptEnd - ( vtEnd * dLength) - nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB) - table.insert( pPaths, { nAuxId, 2, ptIniP}) + if BL.IsPointOnBoxLimits( ptEnd, b3Solid) then + local ptIniP = ptEnd + local ptEndP = ptEnd - ( vtEnd * dLength) + local nAuxId = EgtLine( nAddGrpId, ptIniP, ptEndP, GDB_RT.GLOB) + table.insert( pPaths, { nAuxId, 2, ptIniP}) + end return pPaths end @@ -5081,7 +5086,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, -- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati for i = 1, nNumId do local nIdPath = nFirstId + i - 1 - pPaths = MakePathsOnExtremPoints( nAddGrpId, nIdPath, pPaths, dTDiam) + pPaths = MakePathsOnExtremePoints( nAddGrpId, nIdPath, pPaths, dTDiam, b3Solid) end end -- alrimenti ho la faccia aggiunta @@ -5116,7 +5121,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, -- se non ho un percorso chiuso estraggo i percorsi if bOpenPath then -- creo percorsi antisplint dagli estremi dei percorsi di contorno trovati - pPaths = MakePathsOnExtremPoints( nAddGrpId, nFirstId, pPaths, dTDiam) + pPaths = MakePathsOnExtremePoints( nAddGrpId, nFirstId, pPaths, dTDiam, b3Solid) end EgtErase(nFirstId) end From 32052e30169562300668059ec0716703318a107b Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 9 Apr 2026 16:46:18 +0200 Subject: [PATCH 4/5] - piccola correzione in DtMortise --- LuaLibs/ProcessDtMortise.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 36e71fb..dcaf46a 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -229,10 +229,10 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) end local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local dAltMort = b3DtMrt:getDimZ() - -- verifico se di tipo pocket + -- verifico se di tipo pocket o se antischeggia disabilitato local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1) - local dForcePrecutBypass = EgtGetInfo( Proc.Id, 'Q01', 'i') - if bPocket or dForcePrecutBypass == 1 then bMakeAntiSplitPath = false end + local bDisableAntiSplint = ( EgtGetInfo( Proc.Id, 'Q01', 'i') or 0) == 1 + if bPocket or bDisableAntiSplint then bMakeAntiSplitPath = false end -- verifico se frontale local bFront = ( Proc.Prc == 56) -- se mortasa di fronte, eseguo il taglio della faccia From ca210982264bd8f05fbd5349b180d4d21922c092 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 10 Apr 2026 09:42:21 +0200 Subject: [PATCH 5/5] - update log e txt --- UpdateLog.txt | 6 ++++++ Version.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UpdateLog.txt b/UpdateLog.txt index 4f20572..f61c848 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,4 +1,10 @@ ==== Beam Update Log ==== + +Versione 3.1d2 (10/04/2026) +- Added : in StepJoint aggiunto Q02=1 per forzare fresa +- Added : in DtMortise aggiunto Q01=1 per disabilitare antischeggia +- Fixed : in LapJoint correzione a antischeggia con fresa in caso di feature spezzata + Versione 3.1d1 (08/04/2026) - Added : le forature vengono accorciate con massima elevazione anche in presenza di tagli di testa - Modif : nelle slot con lama verticali si lavora sempre in concordanza diff --git a/Version.lua b/Version.lua index 1fdd5cf..b9770cc 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '3.1d1' +VERSION = '3.1d2' MIN_EXE = '3.1b1'