From 4a408e3f619839fcec77381d77c64412d155aa3d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Wed, 24 Jan 2024 11:46:13 +0100 Subject: [PATCH] DataBeam 2.6a1 : - modifiche per poter impostare offset intermedio anche se lanciato da EgtCam5 - corretto calcolo cubetti con superficie limitante parallela e opposta a quella di base - modifiche a Split per tagli a cubetti su grandi sezioni. --- BatchProcess.lua | 2 +- BatchProcessNew.lua | 2 +- LuaLibs/BeamExec.lua | 23 +++++++++++++++++------ LuaLibs/DiceCut.lua | 4 ++-- LuaLibs/ProcessSplit.lua | 16 +++++++++------- Process.lua | 17 +++++++++++++---- Version.lua | 6 +++--- 7 files changed, 46 insertions(+), 24 deletions(-) diff --git a/BatchProcess.lua b/BatchProcess.lua index f666518..b8f9d3c 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -357,7 +357,7 @@ if bToProcess then local dOvmHead = vBeam[1].PosX or 0 -- Sistemo le travi nel grezzo - local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam) + local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam) if not bPbOk then BEAM.ERR = 18 BEAM.MSG = sPbErr diff --git a/BatchProcessNew.lua b/BatchProcessNew.lua index b40afe1..3d32ed0 100644 --- a/BatchProcessNew.lua +++ b/BatchProcessNew.lua @@ -405,7 +405,7 @@ if bToProcess then end -- Sistemo le travi nel grezzo - local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, BEAM.FLAG == 6) + local bPbOk, sPbErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, nil, vBeam, BEAM.FLAG == 6) if not bPbOk then BEAM.ERR = 18 BEAM.MSG = sPbErr diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index ee06769..93bd6f6 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -517,12 +517,15 @@ local function VerifyBigSectionCut( dRawW, dRawH) end ------------------------------------------------------------------------------------------------------------- -function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroupOk) +function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam, bMachGroupOk) -- default per nuove costanti qualora non definite BD.OVM_BLADE_HBEAM = ( BD.OVM_BLADE_HBEAM or 11) BD.OVM_CHAIN_HBEAM = ( BD.OVM_CHAIN_HBEAM or 8) - + + -- sovramateriale intermedio nullo se non definito + dOvmMid = ( dOvmMid or 0) + -- Determinazione minimo grezzo scaricabile BeamExec.CalcMinUnloadableRaw( dRawW, dRawH) @@ -579,8 +582,12 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup local lastB3Solid = nil local dOffset = dOvmHead if i > 1 then - lastB3Solid = vBeam[i-1].Box - dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX() + if vBeam[i].PosX then + lastB3Solid = vBeam[i-1].Box + dOffset = vBeam[i].PosX - vBeam[i-1].PosX - lastB3Solid:getDimX() + else + dOffset = dOvmMid + end end -- analizzo le features per valutare l'esistenza di feature head/tail che renderebbero inutili le rispettive finiture o di tagli di testa/coda sostituiti da cui leggere il parametro Q05 local vProc = CollectFeatures( Pz, b3Solid, 0) @@ -615,8 +622,12 @@ function BeamExec.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam, bMachGroup ( abs( PartHeight - dRawW) < 100 * GEO.EPS_SMALL and abs( PartWidth - dRawH) < 100 * GEO.EPS_SMALL)) and NextLen + DeltaE >= 0 then -- eventuale sovramateriale di testa - if i > 1 and vBeam[i].PosX then - DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin) + if i > 1 then + if vBeam[i].PosX then + DeltaS = max( vBeam[i].PosX - ( dRawL - Len), DeltaSMin) + else + DeltaS = max( dOvmMid - DeltaE, 0) + end end -- dimensioni del grezzo local CrawLen = min( PartLen + DeltaS + DeltaE, Len) diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index c8bb109..d53cad2 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -1,4 +1,4 @@ --- DiceCut.lua by Egaltech s.r.l. 2023/06/29 +-- DiceCut.lua by Egaltech s.r.l. 2024/01/23 -- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli -- Tabella per definizione modulo @@ -396,7 +396,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl end local dElevP = DistanzaMassima( nParent, ptCPlanes, vtNPlanes, ptCBond, vtNBond, BBoxRawPart, TBoxPoint) local dElevO - if ptCBond and vtNBond then + if ptCBond and vtNBond and not AreOppositeVectorApprox( vtNBond, vtNPlanes) then dElevO = DistanzaMassima( nParent, ptCBond, vtNBond, ptCPlanes, vtNPlanes, BBoxRawPart, TBoxPoint) end diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index ea91656..e03be69 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -248,7 +248,7 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi -local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) @@ -261,11 +261,11 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) end end local bOk, sErr - -- tagli orizzontali + -- tagli verticali for j = nVerticalCuts, 1, -1 do local nFaceUse = MCH_MILL_FU.PARAL_FRONT local dVerticalCutOffset = dVerticalSliceHeight * -j - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, '', b3Raw) + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dVerticalCutOffset, 0, 0, sNotes, b3Raw) if not bOk then return bOk, sErr end end return bOk, sErr @@ -344,7 +344,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then local b3NextRaw = EgtGetRawPartBBox( nNextRawId) dLenEndRaw = ptC:getX() - b3NextRaw:getMin():getX() - nCuts = ceil( dLenEndRaw / ( BD.MAX_LEN_SCRAP + 0.5)) + nCuts = ceil( dLenEndRaw / ( EgtIf( bBigSectionCut, BD.MAX_DIM_DICE - 0.1, BD.MAX_LEN_SCRAP + 0.5))) dOffsL = dLenEndRaw / nCuts -- aggiorno ingombro del grezzo corrente con quello del successivo b3Raw:Add( b3NextRaw) @@ -504,7 +504,7 @@ 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) + bOk, sErr = AddVerticalPreCuts( AddProc, sCutting, 0, b3Raw, sNotes) 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) @@ -629,7 +629,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dCutOffset = ( i - 1) * dOffsL -- se trave larga effettuo tagli verticali aggiuntivi if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then - local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes) if not bOk then return bOk, sErr end end local sNotes @@ -680,7 +681,8 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dCutOffset = ( i - 1) * dOffsL -- se trave larga effettuo tagli verticali aggiuntivi if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then - local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) + local sSpecNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') + local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw, sSpecNotes) if not bOk then return bOk, sErr end end local sNotes diff --git a/Process.lua b/Process.lua index 37b89be..ea714f4 100644 --- a/Process.lua +++ b/Process.lua @@ -140,6 +140,7 @@ local function MyProcessBeams() ', Lmax='..EgtNumToString( BD.MAX_RAW, 0)..',MinUlr='..EgtNumToString( BD.MinRaw + BD.OVM_MID, 0)..')', {'Lunghezza grezzo', EgtNumToString( BD.STD_RAW, 0)}, {'Sovramateriale di testa', EgtNumToString( BD.OVM_HEAD, 0)}, + {'Offset intermedio', EgtNumToString( BD.OVM_MID, 0)}, {'Forza sezione verticale', ' CB:true,*false'}, {'Ordina per lunghezza', ' CB:true,*false'}) if not vsVal then @@ -164,9 +165,17 @@ local function MyProcessBeams() EgtDraw() return false end - + local dOvmMid = EgtEvalNumExpr( vsVal[3]) + if not dOvmMid then + local sOut = 'Offset intermedio : ' .. vsVal[3] + EgtOutLog( sOut) + EgtOutBox( sOut, 'Lavora Travi', 'WARNING') + EgtDraw() + return false + end + -- Sistemo sezione barra con travi - local bVert = ( vsVal[3] == 'true') + local bVert = ( vsVal[4] == 'true') if bVert then if dRawW > dRawH then dRawW, dRawH = dRawH, dRawW end end @@ -206,7 +215,7 @@ local function MyProcessBeams() end -- Se richiesto, ordino le travi in senso di lunghezza crescente - local bOrd = ( vsVal[4] == 'true') + local bOrd = ( vsVal[5] == 'true') if bOrd then table.sort( vBeam, function( B1, B2) if abs( B1.Box:getDimX() - B2.Box:getDimX()) < 1 then @@ -226,7 +235,7 @@ local function MyProcessBeams() end -- Sistemo le travi nel grezzo - local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, vBeam) + local bOk, sErr = BE.ProcessBeams( dRawW, dRawH, dRawL, dOvmHead, dOvmMid, vBeam) if not bOk then EgtOutLog( sErr) EgtOutBox( sErr, 'Lavora Travi', 'ERROR') diff --git a/Version.lua b/Version.lua index 4c03815..7aeadf8 100644 --- a/Version.lua +++ b/Version.lua @@ -1,6 +1,6 @@ --- Version.lua by Egaltech s.r.l. 2024/01/08 +-- Version.lua by Egaltech s.r.l. 2024/01/24 -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.5l3' -MIN_EXE = '2.5l3' +VERSION = '2.6a1' +MIN_EXE = '2.6a1'