From 4685b6bde653178bf311ce72b413de5cb9818b91 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 29 Aug 2024 10:47:51 +0200 Subject: [PATCH 01/14] - se lapjoint attraversata da L055, la lapjoint viene fatta prima --- LuaLibs/BeamExec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index eed5a0a..4be9e8b 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -844,6 +844,16 @@ local function OrderFeatures( vProc, b3Raw) B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then return false end + -- se primo è ribasso e secondo è una mortasa a coda di rondine, il ribasso va sempre prima a meno che la mortasa a coda di rondine non sia di testa + if LapJoint.Identify(B1) and B1.PassedByDtMortise and DtMortise.SideIdentify(B2) and + B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then + return true + end + -- se primo è mortasa a coda di rondine e secondo è ribasso, la mortasa a coda di rondine va sempre dopo a meno che la mortasa a coda di rondine non sia di testa + if DtMortise.SideIdentify(B1) and LapJoint.Identify(B2) and B2.PassedByDtMortise and + B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then + return false + end -- se primo è feature di coda e l'altro è separazione o non è feature di coda if B1.Tail and ( Split.Identify( B2) or not B2.Tail) then return false @@ -2003,6 +2013,10 @@ function GetFeatureInfoAndDependency( vProc, b3Raw) if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then Proc.PassedByHole = true end + -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine + if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then + Proc.PassedByDtMortise = true + end -- verifiche per specchiature if BD.DOWN_HEAD or BD.TWO_EQUAL_HEADS then -- forature From da7ebc6b97f0009a66be87cd82a89693817c22e3 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 29 Aug 2024 18:17:08 +0200 Subject: [PATCH 02/14] - refactoring di ProcessHeadCut --- LuaLibs/ProcessHeadCut.lua | 275 ++++++++++++++++++++----------------- 1 file changed, 146 insertions(+), 129 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 31f4069..1936b69 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -156,7 +156,7 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi -local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) +local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1 local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) @@ -180,6 +180,135 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw ) return bOk, sErr end +--------------------------------------------------------------------- +-- tagli standard +local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts) + if not HeadCutType.bDoubleHorizCut then + -- flag di lavorazione faccia + local nOrthoOpposite = EgtIf( HeadCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) + -- calcolo extra taglio ed accorciamento + local dCutExtra = 0 + local dAccStart = 0 + local dAccEnd = 0 + + if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then + dCutExtra = EgtIf( HeadCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) + else + dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth) + local dSawRad = Cutting1Data.dSawDiam / 2 + -- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra + -- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave + local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( HeadCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) + -- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa + local dMinSawingLength = 5 + if BD.C_SIMM then + dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) + -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata + if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then + dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength + end + else + dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) + -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita + if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then + dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength + end + end + end + + -- per travi alte faccio dei tagli orizzontali aggiuntivi + if bNeedHorizontalAddedCuts then + local nHorizontalCuts = ceil( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1 + local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1) + for i = nCuts, 1, -1 do + local dCutXOffset = ( i - 1) * dOffsetBetweenCuts + -- tagli orizzontali + 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) + if not bOk then return bOk, sErr end + end + -- se necessario taglio verticale doppio, eseguo l'opposto + if HeadCutType.bDoubleCut then + -- gli accorciamenti vanno invertiti per il taglio opposto + local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) + if not bOk then return false, sErr end + end + -- taglio verticale + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw) + if not bOk then return bOk, sErr end + end + return true, sWarn + end + + -- se necessari tagli in doppio, eseguo gli opposti + if HeadCutType.bDoubleCut then + -- gli accorciamenti vanno invertiti per il taglio opposto + local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) + if not bOk then return false, sErr end + end + end + -- eseguo i tagli necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + -- se trave larga effettuo tagli verticali aggiuntivi + if bNeedVerticalAddedCuts then + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) + if not bOk then return bOk, sErr end + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) + if not bOk then return false, sErr end + end + -- altrimenti necessari tagli da sopra e sotto con testa opportuna + else + -- verifico esistenza della lavorazione con lama da sotto + if not Cutting2Data.sCutting then + local sErr = 'Error : cutting H2 not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- verifico che le due lame riescano a lavorare la sezione + local dDimZ = b3Raw:getDimZ() + local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ + if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not HeadCutType.bBigSectionCut then + local sErr = 'Error : section too big for head cut' + EgtOutLog( sErr) + return false, sErr + end + -- calcolo extra taglio ed accorciamento + local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dAccStart = 0 + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + -- eseguo i tagli da sotto necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true) + if not bOk then return false, sErr end + end + -- eseguo i tagli da sopra necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + -- se trave larga effettuo tagli verticali aggiuntivi + if bNeedVerticalAddedCuts then + local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) + 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) + if not bOk then return false, sErr end + end + end + + return true +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut) @@ -243,7 +372,6 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1) local dOffsL = dOvmHead / nCuts - local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) local dMinOvmHeadForAddeddCuts = 10.123 -- se taglio per sezioni alte e larghe if bBigSectionCut then @@ -264,7 +392,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if dMaxElev > dSawThickCheck then local bOk, sErr -- se trave larga effettuo tagli verticali aggiuntivi - if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + if ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti for i = nCuts, 1, -1 do local nAddGrpId = BL.GetAddGroup( Proc.PartId) @@ -289,11 +417,11 @@ 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, dCurrOvmT, nil, nLimitingSurf) + bOk, sErr = Cut.Make( AddProc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, nil, nil, nLimitingSurf) end -- tagli aggiuntivi non necessari else - bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true, nil, nil, dCurrOvmT) + bOk, sErr = Cut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, nil, false, true) end return bOk, sErr end @@ -316,131 +444,20 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end end end - -- se tagli standard - if not bDoubleHorizCut then - -- flag di lavorazione faccia - local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) - -- calcolo extra taglio ed accorciamento - local dCutExtra = 0 - local dAccStart = 0 - local dAccEnd = 0 - if b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then - dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) - else - dCutExtra = - ( b3Raw:getDimY() - dMaxDepth) - local dSawRad = dSawDiam / 2 - -- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra - -- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave - local dKL = dSawRad - dMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) - -- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa - local dMinSawingLength = 5 - if BD.C_SIMM then - dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) - -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata - if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then - dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength - end - else - dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) - -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita - if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then - dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength - end - end - end - - -- per travi alte faccio dei tagli orizzontali aggiuntivi - local bAreHorizontalCutsNeeded = ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) - if bAreHorizontalCutsNeeded then - local nHorizontalCuts = ceil( dimV / BD.MAX_DIM_DICE) - 1 - local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1) - for i = nCuts, 1, -1 do - local dCutXOffset = ( i - 1) * dOffsL - -- tagli orizzontali - 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, sCutting, dSawDiam, nFaceUse, nil, -0.1 -dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, '', b3Raw, nil, nil, nil, bForceTangentLeadInOut) - if not bOk then return bOk, sErr end - end - -- se necessario taglio verticale doppio, eseguo l'opposto - if bDoubleCut then - -- gli accorciamenti vanno invertiti per il taglio opposto - local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) - if not bOk then return false, sErr end - end - -- taglio verticale - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, '', b3Raw) - if not bOk then return bOk, sErr end - end - return true, sWarn - end - - -- se necessari tagli in doppio, eseguo gli opposti - if bDoubleCut then - -- gli accorciamenti vanno invertiti per il taglio opposto - local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) - if not bOk then return false, sErr end - end - end - -- eseguo i tagli necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - -- se trave larga effettuo tagli verticali aggiuntivi - if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then - local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) - if not bOk then return bOk, sErr end - end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) - if not bOk then return false, sErr end - end - -- altrimenti necessari tagli da sopra e sotto con testa opportuna - else - -- verifico esistenza della lavorazione con lama da sotto - if not sCutting2 then - local sErr = 'Error : cutting H2 not found in library' - EgtOutLog( sErr) - return false, sErr - end - -- verifico che le due lame riescano a lavorare la sezione - local dDimZ = b3Raw:getDimZ() - local dExtra = dMaxVertDepth + dMaxDepth2 - dDimZ - if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then - local sErr = 'Error : section too big for head cut' - EgtOutLog( sErr) - return false, sErr - end - -- calcolo extra taglio ed accorciamento - local dCutExtra = -dMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN - local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN - local dAccStart = 0 - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end - -- eseguo i tagli da sotto necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true) - if not bOk then return false, sErr end - end - -- eseguo i tagli da sopra necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - -- se trave larga effettuo tagli verticali aggiuntivi - if ( dimH > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then - local bOk, sErr = AddVerticalPreCuts( Proc, sCutting, dCutOffset, b3Raw) - if not bOk then return bOk, sErr end - end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw) - if not bOk then return false, sErr end - end + + local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut} + local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick } + local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2 } + local bNeedVerticalAddedCuts = false + if ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + bNeedVerticalAddedCuts = true end - return true -end + local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) + + local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts) + + return bOk, sErr +end --------------------------------------------------------------------- return ProcessHeadCut From 6e4dee29af536b7e542c1d63a4722951f323763b Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 2 Sep 2024 10:29:08 +0200 Subject: [PATCH 03/14] modifiche a HeadCut per introduzione tagli a zero (PreCut) per evitare problemi con pezzi non lunghi quanto ci si aspetta --- LuaLibs/ProcessHeadCut.lua | 71 +++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 1936b69..c391ca4 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -157,9 +157,8 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) - local _, dimH = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local nVerticalCuts = ceil( dimH / ( BD.MAX_LEN_DICE)) - 1 - local dVerticalSliceHeight = dimH / ( nVerticalCuts + 1) + local nVerticalCuts = ceil( Proc.Face[1].HeightTrimmed / ( BD.MAX_LEN_DICE)) - 1 + local dVerticalSliceHeight = Proc.Face[1].HeightTrimmed / ( nVerticalCuts + 1) -- recupero il diametro dell'utensile local dSawDiam = 400 if EgtMdbSetCurrMachining( sCutting) then @@ -182,7 +181,8 @@ end --------------------------------------------------------------------- -- tagli standard -local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts) +local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset) + local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} if not HeadCutType.bDoubleHorizCut then -- flag di lavorazione faccia local nOrthoOpposite = EgtIf( HeadCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) @@ -217,7 +217,11 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut end -- per travi alte faccio dei tagli orizzontali aggiuntivi - if bNeedHorizontalAddedCuts then + if HeadCutType.bNeedHorizontalAddedCuts then + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end local nHorizontalCuts = ceil( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1 local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1) for i = nCuts, 1, -1 do @@ -250,6 +254,9 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) if not bOk then return false, sErr end end @@ -258,10 +265,17 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts -- se trave larga effettuo tagli verticali aggiuntivi - if bNeedVerticalAddedCuts then + if HeadCutType.bNeedVerticalAddedCuts then + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) if not bOk then return bOk, sErr end end + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) if not bOk then return false, sErr end end @@ -290,14 +304,24 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut -- eseguo i tagli da sotto necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true) if not bOk then return false, sErr end end -- eseguo i tagli da sopra necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end -- se trave larga effettuo tagli verticali aggiuntivi - if bNeedVerticalAddedCuts then + if HeadCutType.bNeedVerticalAddedCuts then + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) if not bOk then return bOk, sErr end end @@ -353,7 +377,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid2) or '') then dSawDiam2 = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam2 dMaxDepth2 = EgtTdbGetCurrToolMaxDepth() or dMaxDepth2 - dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2 + dSawThick2 = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick2 end end -- caratteristiche taglio @@ -363,6 +387,16 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local bHorizCut = ( ( b3Raw:getDimY() > b3Raw:getDimZ() + 10 * GEO.EPS_SMALL or BD.TURN) and b3Raw:getDimZ() < dMaxVertDepth - BD.CUT_EXTRA) local bDoubleHorizCut = ( ( BD.DOWN_HEAD or BD.TURN) and not bHorizCut and b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) + -- verifico necessità di tagli aggiuntivi orizzontali o verticali + local dMinOvmHeadForAddeddCuts = 10.123 + local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) + local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) + -- dati lavorazioni sopra e sotto + local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} + local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2} + -- dati sul taglio di testa da effettuare + local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts} + local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- se non obbligatorio e coincide con inizio grezzo, non va fatto @@ -372,7 +406,6 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- determino se lo spessore del materiale da rimuovere è eccessivo e quindi vanno fatti più tagli con offset local nCuts = max( ceil( dOvmHead / (( BD.MAX_LEN_SCRAP_START or BD.MAX_LEN_SCRAP) + 0.5)), 1) local dOffsL = dOvmHead / nCuts - local dMinOvmHeadForAddeddCuts = 10.123 -- se taglio per sezioni alte e larghe if bBigSectionCut then if dOvmHead > 0 then @@ -391,8 +424,15 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if dMaxElev > dSawThickCheck then local bOk, sErr + -- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto + -- TODO qui mettere sega a catena + local dStartOffset = dOvmHead + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end -- se trave larga effettuo tagli verticali aggiuntivi - if ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then + if bNeedVerticalAddedCuts then -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti for i = nCuts, 1, -1 do local nAddGrpId = BL.GetAddGroup( Proc.PartId) @@ -445,16 +485,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end end - local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut} - local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick } - local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2 } - local bNeedVerticalAddedCuts = false - if ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) then - bNeedVerticalAddedCuts = true - end - local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) - - local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts) + local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data) return bOk, sErr end From 6ecd613f12cc3d9b03b60b9464a38d43c6af50fb Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 2 Sep 2024 16:54:47 +0200 Subject: [PATCH 04/14] - in HeadCut corrette Width e Height invertite --- LuaLibs/ProcessHeadCut.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index c391ca4..7d0653f 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -157,8 +157,8 @@ end --------------------------------------------------------------------- -- tagli verticali aggiuntivi local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) - local nVerticalCuts = ceil( Proc.Face[1].HeightTrimmed / ( BD.MAX_LEN_DICE)) - 1 - local dVerticalSliceHeight = Proc.Face[1].HeightTrimmed / ( nVerticalCuts + 1) + 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 local dSawDiam = 400 if EgtMdbSetCurrMachining( sCutting) then From 69514074a94058c17d307ed86aaea261e4c9bf5e Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 3 Sep 2024 12:45:28 +0200 Subject: [PATCH 05/14] - In ScarfJoint, in ApplyDiceCut, tagli paralleli fatti con unico passaggio di fianco --- LuaLibs/ProcessScarfJoint.lua | 51 ++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index 84af102..1b33c52 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -4,6 +4,7 @@ -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) -- 2022/07/12 Aggiunta gestione PF1250 e TURN. -- 2023/02/14 Gestite le rotazioni di 90 deg nell'aggiornamento del grezzo. +-- 2024/09/03 In ApplyDiceCut, se possibile, i tagli paralleli sono fatti con un unico passaggio di fianco. -- Tabella per definizione modulo local ProcessScarfJoint = {} @@ -134,7 +135,9 @@ end local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) local bOk = true + local bOk2 = true local sErr = '' + local sErr2 = '' local vCuts = {} if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then @@ -185,9 +188,49 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli -- extra taglio local dExtraCut = EgtIf( i % 2 == 1, 0, BD.CUT_EXTRA) -- lavoro la faccia - for j = 1, #vCuts[i] do - bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOk then return bOk, sErr end + local dMaxDepth = 0 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end + + local dDiceFaceMaxH = 0 + local dDiceFaceMinH = GEO.INFINITO + if ( i % 2) == 0 then + for cont = 1, #vCuts[i] do + local _, dDiceFaceH, dDiceFaceV = BL.GetFaceHvRefDim( vCuts[i][cont], 0) + dDiceFaceMaxH = max( dDiceFaceMaxH, dDiceFaceH) + -- calcolo lato orizzontale minore ipotizzando sia un trapezio + local dDiceFaceH2 = ( 2 * EgtSurfArea( vCuts[i][cont]) ) / dDiceFaceV - dDiceFaceH + dDiceFaceMinH = min( dDiceFaceMinH, dDiceFaceH2) + end + end + -- se si può fare, faccio unico taglio parallelo + if ( i % 2) == 0 and ( dMaxDepth > dDiceFaceMaxH - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN) then + local bDoubleCut = false + local dCutExtra = BD.CUT_EXTRA + if dMaxDepth < dDiceFaceMaxH + BD.CUT_EXTRA then + bDoubleCut = true + dCutExtra = - 0.5 * dDiceFaceMinH + BD.CUT_EXTRA_MIN + end + local nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false) + local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT + if Proc.Tail then + nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1 + end + if bDoubleCut then + bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true) + if not bOk then return false, sErr end + end + bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw) + if not bOk2 then return false, sErr2 end + else + for j = 1, #vCuts[i] do + bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOk then return bOk, sErr end + end end end -- lavoro la faccia interna in ogni caso @@ -201,7 +244,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli if vFaceOrd[3] ~= 0 then -- inserisco la lavorazione local vtOrthoO = Vector3d( vtRef) - local bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end end end From c5a8b852d9ef101e08b094be476e71a7928fcd0b Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Tue, 3 Sep 2024 15:11:53 +0200 Subject: [PATCH 06/14] - in LapJpint, in MakeLongMoreFaces si aggiunge faccia di fondo anche per topologia Groove passante a 3 facce --- LuaLibs/ProcessLapJoint.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index ed06d87..debd5ac 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -108,6 +108,7 @@ -- 2024/06/18 In MakeByMillAsSaw si cerca di orientare il motore verso il lato più vicino (rispetto a dove è la feature) -- 2024/06/28 In VerifySideMillAsSaw modificato criterio ricerca utensile in base a normale della faccia -- 2024/07/04 In IsTailFeature controllo per spostare lapjoint dopo taglio di separazione per lavorazioni tipo BH +-- 2024/09/03 In MakeLongMoreFaces si aggiunge faccia di fondo anche per topologia Groove passante a 3 facce -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -6847,7 +6848,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- verifico se applicare gestione speciale per tunnel local nSurfBottomId - if Proc.Topology == 'Tunnel' then + if Proc.Topology == 'Tunnel' or ( Proc.Topology == 'Groove' and Proc.IsThrough and Proc.Fct == 3) then bAddEndCapLeftSide = true bAddEndCapRightSide = true -- recupero centro e normale delle facce From cc5117aa11a6d92eeae18781377f8b16e9e104f5 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 3 Sep 2024 18:02:18 +0200 Subject: [PATCH 07/14] - in Split refactoring e implemento pretaglio a zero - in HeadCut piccole migliorie in pretaglio a zero --- LuaLibs/ProcessHeadCut.lua | 75 +++-- LuaLibs/ProcessSplit.lua | 566 +++++++++++++++++++++---------------- 2 files changed, 380 insertions(+), 261 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 7d0653f..a17856f 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -22,6 +22,7 @@ local Fbs = require( 'FacesBySaw') local Cut = require( 'ProcessCut') local Pocket = require( 'FaceByPocket') local Topology = require( 'FeatureTopology') +local Split = require( 'ProcessSplit') EgtOutLog( ' ProcessHeadCut started', 1) @@ -29,6 +30,10 @@ EgtOutLog( ' ProcessHeadCut started', 1) local BD = require( 'BeamData') local ML = require( 'MachiningLib') +if BD.PRECUT_HEAD == nil then + BD.PRECUT_HEAD = true +end + --------------------------------------------------------------------- -- Riconoscimento della feature function ProcessHeadCut.Identify( Proc) @@ -176,12 +181,13 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw) 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) if not bOk then return bOk, sErr end end + return bOk, sErr end --------------------------------------------------------------------- -- tagli standard -local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset) +local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset, dOvmHead) local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} if not HeadCutType.bDoubleHorizCut then -- flag di lavorazione faccia @@ -218,9 +224,13 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut -- per travi alte faccio dei tagli orizzontali aggiuntivi if HeadCutType.bNeedHorizontalAddedCuts then - local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) - if not bOkPrecut then - return false, sErrPrecut + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD then + dStartOffset = dOvmHead + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end end local nHorizontalCuts = ceil( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1 local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1) @@ -248,6 +258,14 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut return true, sWarn end + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then + dStartOffset = dOvmHead + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end + end -- se necessari tagli in doppio, eseguo gli opposti if HeadCutType.bDoubleCut then -- gli accorciamenti vanno invertiti per il taglio opposto @@ -266,10 +284,6 @@ 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 bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) - if not bOkPrecut then - return false, sErrPrecut - end local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) if not bOk then return bOk, sErr end end @@ -301,6 +315,14 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local dAccStart = 0 local dVzLimDwnUp if BD.TURN then dVzLimDwnUp = -2 end + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not ( HeadCutType.bBigSectionCut) and BD.PRECUT_HEAD and HeadCutType.bNeedVerticalAddedCuts then + dStartOffset = dOvmHead + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end + end -- eseguo i tagli da sotto necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts @@ -318,10 +340,6 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut end -- se trave larga effettuo tagli verticali aggiuntivi if HeadCutType.bNeedVerticalAddedCuts then - local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) - if not bOkPrecut then - return false, sErrPrecut - end local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) if not bOk then return bOk, sErr end end @@ -396,7 +414,6 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2} -- dati sul taglio di testa da effettuare local HeadCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts} - local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- se non obbligatorio e coincide con inizio grezzo, non va fatto @@ -421,16 +438,32 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut else dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() end - -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard - if dMaxElev > dSawThickCheck then - local bOk, sErr - -- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto - -- TODO qui mettere sega a catena - local dStartOffset = dOvmHead - local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + -- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto + if BD.PRECUT_HEAD then + -- recupero dati utensile della sega a catena più lunga a disposizione + local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest') + if not sSawing then + sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + end + local dChainSawMaxMat = 0 + local dChainSawLen = 0 + if EgtMdbSetCurrMachining( sSawing or '') then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat + dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen + end + end + local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bInvert = true} + local dOffset = dOvmHead + local bOkPrecut, sErrPrecut = Split.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data) if not bOkPrecut then return false, sErrPrecut end + end + -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard + if dMaxElev > dSawThickCheck then + local bOk, sErr -- se trave larga effettuo tagli verticali aggiuntivi if bNeedVerticalAddedCuts then -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti @@ -485,7 +518,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut end end - local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data) + local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, HeadCutType, Cutting1Data, Cutting2Data, nil, dOvmHead) return bOk, sErr end diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 829f68c..cacc585 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -38,6 +38,10 @@ EgtOutLog( ' ProcessSplit started', 1) local BD = require( 'BeamData') local ML = require( 'MachiningLib') +if BD.PRECUT_TAIL == nil then + BD.PRECUT_TAIL = true +end + --------------------------------------------------------------------- -- Riconoscimento della feature function ProcessSplit.Identify( Proc) @@ -63,7 +67,7 @@ end --------------------------------------------------------------------- -- lavorazione smussi -local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) +local function MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail) -- verifico che lo smusso sia richiesto local dDepth = EgtGetInfo( nOriId, 'Q06', 'd') or 0 if dDepth < 0.1 then return true end @@ -165,7 +169,7 @@ end --------------------------------------------------------------------- -- lavorazione con sega a catena per sezioni alte e larghe -local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dOffs, bExtendStartEnd) +local function MakeCutByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, dRadialOffset, bExtendStartEnd, bInvert) -- Recupero i dati dell'utensile local dMaxMat = 0 local dSawCornerRad = 0 @@ -205,7 +209,7 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, local vtOrtho = BL.GetVersRef( nFaceUse) EgtSetMachiningParam( MCH_MP.INITANGS, BL.GetChainSawInitAngs( vtN, vtOrtho, 1)) -- imposto offset radiale per mantenere il materiale in coda per la finitura - EgtSetMachiningParam( MCH_MP.OFFSR, dOffs) + EgtSetMachiningParam( MCH_MP.OFFSR, dRadialOffset) -- imposto eventuale allungamento percorso iniziale local dStartAddLen = 0 local dEndAddLen = 0 @@ -217,7 +221,13 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dEndAddLen) -- faccio in modo che l'attacco della lama sia dal lato opposto rispetto al corpo macchina EgtSetMachiningParam( MCH_MP.TOOLINVERT, true) - EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + if bInvert and bInvert == true then + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT) + EgtSetMachiningParam( MCH_MP.INVERT, true) + else + EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.LEFT) + EgtSetMachiningParam( MCH_MP.INVERT, false) + end if dMaxMat >= dDepth then EgtSetMachiningParam( MCH_MP.DEPTH, dDepth) -- se massimo affondamento utensile inferiore fessura, setto affondamento ed emetto warning @@ -253,12 +263,78 @@ local function MakeSplitByChainSaw( nSurfId, sSawing, nFaceUse, dDepth, sNotes, return true, sName, nMchFId end +--------------------------------------------------------------------- +-- split per sezioni grandi con sega a catena o mix catena + lama +function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data) + local bigSectionSplitType + -- se pezzo non troppo alto, taglio singolo da sopra + if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "single horizontal" + -- se pezzo non troppo largo, taglio singolo da davanti + elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "single vertical" + -- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti) + elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( SawingData.dChainSawMaxMat, SawingData.dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then + bigSectionSplitType = "double vertical" + -- altrimenti taglio con sega a catena da sopra e con lama da sotto + elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < Cutting2Data.dMaxDepth + SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL) then + bigSectionSplitType = "double horizontal" + end + + -- in base alle scelte precedenti, applico le lavorazioni + if bigSectionSplitType == "single horizontal" then + local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN + local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + -- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo + local bExtendStartEnd + local dMinLengthLongChainSaw = 630 + if SawingData.dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then + bExtendStartEnd = true + end + local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffset, bExtendStartEnd, SawingData.bInvert) + if not bOk then return bOk, sErr end + elseif bigSectionSplitType == "single vertical" then + local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN + local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) + if not bOk then return bOk, sErr end + elseif bigSectionSplitType == "double vertical" then + local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN + local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', '') + local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) + if not bOk then return bOk, sErr end + sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) + if not bOk then return bOk, sErr end + elseif bigSectionSplitType == "double horizontal" then + -- sega a catena da sopra + local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - Cutting2Data.dMaxDepth + local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', '') + local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) + if not bOk then return bOk, sErr end + -- lama da sotto + local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + local sNotes = EgtIf( SawingData.bSplit, 'Split;', '') + local bMaximizeVerticalDepth = true + bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffset, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) + if not bOk then return false, sErr end + -- se è comunque troppo grande per essere separato, esco + else + local sErr = 'Error : section too big for splitting' + EgtOutLog( sErr) + return false, sErr, -1 + end + + return true +end + --------------------------------------------------------------------- -- tagli verticali aggiuntivi 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) + 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 local dSawDiam = 400 if EgtMdbSetCurrMachining( sCutting) then @@ -276,9 +352,203 @@ local function AddVerticalPreCuts( Proc, sCutting, dCutXOffset, b3Raw, sNotes) 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) if not bOk then return bOk, sErr end end + return bOk, sErr end +--------------------------------------------------------------------- +-- tagli standard +local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCutType, Cutting1Data, Cutting2Data, dStartOffset, dLenEndRaw) + local PrecutType = { bBigSectionCut = TailCutType.bBigSectionCut, bHorizCut = TailCutType.bHorizCut, bDoubleHorizCut = TailCutType.bDoubleHorizCut, bDoubleCut = TailCutType.bDoubleCut, bSplit = TailCutType.bSplit, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} + if not TailCutType.bDoubleHorizCut then + -- flag di lavorazione faccia + local nOrthoOpposite = EgtIf( TailCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK) + -- calcolo extra taglio ed accorciamento + local dCutExtra = 0 + local dAccStart = 0 + local dAccEnd = 0 + if TailCutType.bBigSectionCut and BD.C_SIMM then + -- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama + local dSawRad = Cutting1Data.dSawDiam / 2 + dCutExtra = - ( b3Raw:getDimY() - dSawRad) + dAccEnd = dSawRad + elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then + dCutExtra = EgtIf( TailCutType.bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) + else + dCutExtra = - ( b3Raw:getDimY() - Cutting1Data.dMaxDepth) + local dSawRad = Cutting1Data.dSawDiam / 2 + -- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra + -- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave + local dKL = dSawRad - Cutting1Data.dMaxDepth + EgtIf( TailCutType.bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) + -- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa + local dMinSawingLength = 5 + if BD.C_SIMM then + dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) + -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata + if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then + dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength + end + else + dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) + -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita + if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then + dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength + end + end + end + + -- per travi alte faccio faccio dei tagli orizzontali aggiuntivi + if TailCutType.bNeedHorizontalAddedCuts then + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL then + dStartOffset = dLenEndRaw + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end + end + local nHorizontalCuts = ceil ( Proc.Face[1].HeightTrimmed / BD.MAX_DIM_DICE) - 1 + local dHorizontalSliceHeight = Proc.Face[1].HeightTrimmed / ( nHorizontalCuts + 1) + for i = nCuts, 1, -1 do + local dCutXOffset = ( i - 1) * dOffsetBetweenCuts + -- tagli orizzontali + 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) + if not bOk then return false, sErr end + end + -- se necessario taglio verticale doppio, eseguo l'opposto + if TailCutType.bDoubleCut then + -- gli accorciamenti vanno invertiti per il taglio opposto + local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, 'Precut;', b3Raw, true) + if not bOk then return false, sErr end + end + -- taglio verticale + local sInfo = 'PreCut;' + if i == 1 then sInfo = 'Cut;' end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw) + if not bOk then return false, sErr end + end + return true, sWarn + end + + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then + dStartOffset = dLenEndRaw + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end + end + -- se necessari tagli in doppio, eseguo gli opposti + if TailCutType.bDoubleCut then + -- gli accorciamenti vanno invertiti per il taglio opposto + local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end + local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true) + if not bOk then return false, sErr end + end + end + -- eseguo i tagli necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + -- 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) + if not bOk then return bOk, sErr end + end + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end + local sNotes + if TailCutType.bSplit then + sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') + else + sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + end + -- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax + if i == nCuts and TailCutType.bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then + sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2) + end + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw) + if not bOk then return false, sErr end + end + -- altrimenti necessari tagli da sopra e sotto con testa opportuna + else + -- verifico esistenza della lavorazione con lama da sotto + if not Cutting2Data.sCutting then + local sErr = 'Error : cutting H2 not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- verifico che le due lame riescano a lavorare la sezione + local dDimZ = b3Raw:getDimZ() + local dExtra = Cutting1Data.dMaxVertDepth + Cutting2Data.dMaxDepth - dDimZ + if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not TailCutType.bBigSectionCut then + local sErr = 'Error : section too big for tail cut' + EgtOutLog( sErr) + return false, sErr + end + -- calcolo extra taglio ed accorciamento + local dCutExtra = -Cutting2Data.dMaxDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dCutExtra2 = -Cutting1Data.dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN + local dAccStart = 0 + -- limiti da sotto + local dVzLimDwnUp + if BD.TURN then dVzLimDwnUp = -2 end + -- taglio a zero (con lama) per evitare problemi con grezzo più lungo del previsto. Se BigSection il pretaglio è già stato fatto. + if not TailCutType.bBigSectionCut and BD.PRECUT_TAIL and TailCutType.bNeedVerticalAddedCuts then + dStartOffset = dLenEndRaw + local bOkPrecut, sErrPrecut = MakeStandardCuts( Proc, b3Raw, 1, 0, PrecutType, Cutting1Data, Cutting2Data, dStartOffset) + if not bOkPrecut then + return false, sErrPrecut + end + end + -- eseguo i tagli da sotto necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end + local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') + local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true) + if not bOk then return false, sErr end + end + -- eseguo i tagli da sopra necessari + for i = nCuts, 1, -1 do + local dCutOffset = ( i - 1) * dOffsetBetweenCuts + if i == 1 and dStartOffset then + dCutOffset = dStartOffset + end + -- 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) + if not bOk then return bOk, sErr end + end + local sNotes + if TailCutType.bSplit then + sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') + else + sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + 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, sNotes, b3Raw) + if not bOk then return false, sErr end + end + end + + return true +end + --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrStd, bPreMove, vtMove, dOvmTail) @@ -290,7 +560,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- inserimento smussi local nOriId = EgtGetInfo( Proc.Id, 'ORI', 'i') if nOriId then - local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmHead) + local bOkc, sErrC = MakeChamfer( nOriId, Proc, nPhase, nRawId, nPartId, dOvmTail) if not bOkc then return bOkc, sErrC end end -- recupero la lavorazione @@ -327,6 +597,20 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dSawThick2 = EgtTdbGetCurrToolParam(MCH_TP.THICK) or dSawThick2 end end + -- recupero dati utensile della sega a catena più lunga a disposizione + local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest') + if not sSawing then + sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') + end + local dChainSawMaxMat = 0 + local dChainSawLen = 0 + if EgtMdbSetCurrMachining( sSawing or '') then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat + dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen + end + end -- caratteristiche taglio local dDimYRef = EgtIf( b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL, dSawMaxDepth, abs( BD.MAX_DIM_HTCUT_HBEAM)) local bBigSectionCut = ( b3Raw:getDimY() > 2 * dDimYRef - BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL) and @@ -336,8 +620,6 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local bDoubleCut = ( not bHorizCut and not bDoubleHorizCut and b3Raw:getDimY() > dDimYRef - BD.CUT_EXTRA + 10 * GEO.EPS_SMALL) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - -- flag di lavorazione faccia - local nOrthoOpposite = EgtIf( bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK) -- separazione solo se esiste grezzo successivo con pezzi o scaricabile local nNextRawId = EgtGetNextRawPart( nRawId) local bSplit = ( nNextRawId and ( EgtGetPartInRawPartCount( nNextRawId) > 0 or EgtGetRawPartBBox( nNextRawId):getDimX() >= BD.MinRaw)) @@ -345,8 +627,6 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt local dLenEndRaw = dOvmTail local nCuts = 1 local dOffsL = 0 - local _, dimH, dimV = BL.GetFaceHvRefDim( Proc.Id, 0, b3Raw) - local dMinTailScrapForAdditionalCuts = 10.123 if not bSplit then -- cerco grezzo successivo che sia nella fase if nNextRawId and EgtVerifyRawPartPhase( nNextRawId, nPhase) then @@ -356,94 +636,38 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt dOffsL = dLenEndRaw / nCuts -- aggiorno ingombro del grezzo corrente con quello del successivo b3Raw:Add( b3NextRaw) + else + dLenEndRaw = 0 end end + -- determino la necessità di tagli aggiuntivi + local dMinTailScrapForAdditionalCuts = 10.123 + local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) + local bNeedHorizontalAddedCuts = not bSplit and ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) + -- dati lavorazioni sopra e sotto + local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} + local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2} + local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bSplit = bSplit} + -- dati sul taglio di coda da effettuare + local TailCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bSplit = bSplit, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts} -- se taglio per pezzi alti e larghi local nNewPhase = 0 if bBigSectionCut then local bFinishingNeeded = false if bSplit then - -- recupero dati utensile della sega a catena più lunga a disposizione - local sSawing = ML.FindSawing( 'SawingForSplitting', nil, nil, 'Longest') - if not sSawing then - sSawing = ML.FindSawing( 'Sawing', nil, nil, 'Longest') - end - local dChainSawMaxMat = 0 - local dChainSawLen = 0 - if EgtMdbSetCurrMachining( sSawing or '') then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dChainSawMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dChainSawMaxMat - dChainSawLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) or dChainSawLen - end - end - - local bigSectionSplitType - -- se pezzo non troppo alto, taglio singolo da sopra - if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dChainSawMaxMat + 10 * GEO.EPS_SMALL then - bigSectionSplitType = "single horizontal" - -- se pezzo non troppo largo, taglio singolo da davanti - elseif b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then - bigSectionSplitType = "single vertical" - -- se pezzo non troppo largo, tagli dai due fianchi (dietro e davanti) - elseif 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN < min( dChainSawMaxMat, dChainSawLen - BD.C_SIMM_ENC) + 10 * GEO.EPS_SMALL then - bigSectionSplitType = "double vertical" - -- altrimenti taglio con sega a catena da sopra e con lama da sotto - elseif BD.DOWN_HEAD and ( b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < dSawMaxDepth2 + dChainSawMaxMat + 10 * GEO.EPS_SMALL) then - bigSectionSplitType = "double horizontal" - end - - -- assegno offset in lunghezza - local dOffs = 0 + -- assegno offset in lunghezza + local dTailOffset = 0 if dOvmTail > BD.OVM_CHAIN_HBEAM then - dOffs = dOvmTail - BD.OVM_CHAIN_HBEAM + dTailOffset = dOvmTail - BD.OVM_CHAIN_HBEAM bFinishingNeeded = true end - - -- in base alle scelte precedenti, applico le lavorazioni - if bigSectionSplitType == "single horizontal" then - local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - local sNotesSplit = 'Split;' - -- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo - local bExtendStartEnd - local dMinLengthLongChainSaw = 630 - if dChainSawLen > dMinLengthLongChainSaw - 10 * GEO.EPS_SMALL then - bExtendStartEnd = true - end - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dCutDepth, sNotesSplit, dOffs, bExtendStartEnd) - if not bOk then return bOk, sErr, nNewPhase end - elseif bigSectionSplitType == "single vertical" then - local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN - local sNotesSplit = 'Split;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) - if not bOk then return bOk, sErr, nNewPhase end - elseif bigSectionSplitType == "double vertical" then - local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN - local sNotesSplit = 'Presplit;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffs) - if not bOk then return bOk, sErr, nNewPhase end - sNotesSplit = 'Split;' - bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffs) - if not bOk then return bOk, sErr, nNewPhase end - elseif bigSectionSplitType == "double horizontal" then - -- sega a catena da sopra - local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - dSawMaxDepth2 - local sNotesSplit = 'Presplit;' - local bOk, sErr = MakeSplitByChainSaw( Proc.Id, sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffs) - if not bOk then return bOk, sErr, nNewPhase end - -- lama da sotto - local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end - local sNotes = 'Split;' - local bMaximizeVerticalDepth = true - bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffs, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) - if not bOk then return false, sErr end - -- se è comunque troppo grande per essere separato, esco - else - local sErr = 'Error : section too big for splitting' - EgtOutLog( sErr) - return false, sErr, -1 + -- split per grande sezione + local bOk, sErr, nNewPhase2 = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data) + if nNewPhase2 then + nNewPhase = nNewPhase2 + end + if not bOk then + return bOk, sErr, nNewPhase end -- se necessaria finitura, creo nuova fase if bFinishingNeeded then @@ -491,12 +715,20 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt else dMaxElev = Proc.Box:getMax():getX() - b3Raw:getMin():getX() end + -- taglio a zero (con sega a catena o mix catena + lama) per evitare problemi con grezzo più lungo del previsto + if BD.PRECUT_TAIL and not bSplit then + local dTailOffset = dLenEndRaw + local bOkPrecut, sErrPrecut = ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dTailOffset, SawingData, Cutting2Data) + if not bOkPrecut then + return false, sErrPrecut + end + end -- se finitura con lama if nQ05 < 2 or ( not bSplit and dMaxElev > dSawThickCheck) then -- controllo se è necessario un taglio con dicing o si deve proseguire ai casi standard if bSplit or dMaxElev > dSawThickCheck then local bOk, sErr - if not bSplit and ( dimH > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) then + if bNeedVerticalAddedCuts then -- ad ogni offset di taglio dovrò fare prima i tagli verticali e poi i cubetti for i = nCuts, 1, -1 do local nAddGrpId = BL.GetAddGroup( Proc.PartId) @@ -561,157 +793,11 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt return true, nil, nNewPhase end end - -- se tagli standard - if not bDoubleHorizCut then - -- calcolo extra taglio ed accorciamento - local dCutExtra = 0 - local dAccStart = 0 - local dAccEnd = 0 - if bBigSectionCut and BD.C_SIMM then - -- qui arrivano sezioni molto grandi su macchine tipo PF con materiale da asportare inferiore allo spessore lama - local dSawRad = dSawDiam / 2 - dCutExtra = - ( b3Raw:getDimY() - dSawRad) - dAccEnd = dSawRad - elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM + 10 * GEO.EPS_SMALL or b3Raw:getDimY() < 2 * BD.MAX_DIM_HTCUT_HBEAM + 10 * GEO.EPS_SMALL then - dCutExtra = EgtIf( bDoubleCut, - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN, BD.CUT_EXTRA) - else - dCutExtra = - ( b3Raw:getDimY() - dSawMaxDepth) - local dSawRad = dSawDiam / 2 - -- distanza in Y tra il centro della lama e l'intersezione tra la lama stessa e la massima Z della trave, + extra - -- se taglio doppio l'intersezione sarà in mezzeria, se taglio singolo sarà all'estremo opposto della trave - local dKL = dSawRad - dSawMaxDepth + EgtIf( bDoubleCut, b3Raw:getDimY() / 2 + BD.CUT_EXTRA_MIN, b3Raw:getDimY() + BD.CUT_EXTRA) - -- lunghezza minima del percorso di lavorazione, in caso accorciamento porti a lunghezza negativa - local dMinSawingLength = 5 - if BD.C_SIMM then - dAccEnd = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) - -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo entrata - if dAccEnd > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then - dAccStart = b3Raw:getDimZ() - dAccEnd - dMinSawingLength - end - else - dAccStart = sqrt( max( dSawRad * dSawRad - dKL * dKL, 0)) - -- non posso comunque accorciare più della dimensione della geometria, quindi in caso allungo uscita - if dAccStart > b3Raw:getDimZ() - 100 * GEO.EPS_SMALL then - dAccEnd = b3Raw:getDimZ() - dAccStart - dMinSawingLength - end - end - end - -- per travi alte faccio faccio dei tagli orizzontali aggiuntivi - local bAreHorizontalCutsNeeded = not bSplit and ( dimV > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) - if bAreHorizontalCutsNeeded then - local nHorizontalCuts = ceil ( dimV / BD.MAX_DIM_DICE) - 1 - local dHorizontalSliceHeight = dimV / ( nHorizontalCuts + 1) - for i = nCuts, 1, -1 do - local dCutXOffset = ( i - 1) * dOffsL - -- tagli orizzontali - 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 , sCutting, dSawDiam, nFaceUse, nil, -0.1 - dCutXOffset, BD.CUT_SIC, dHorizontalCutOffset, 0, 0, 'Precut;', b3Raw, nil, nil, nil, bForceTangentLeadInOut) - if not bOk then return false, sErr end - end - -- se necessario taglio verticale doppio, eseguo l'opposto - if bDoubleCut then - -- gli accorciamenti vanno invertiti per il taglio opposto - local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStartDoubleCut, dAccEndDoubleCut, 'Precut;', b3Raw, true) - if not bOk then return false, sErr end - end - -- taglio verticale - local sInfo = 'PreCut;' - if i == 1 then sInfo = 'Cut;' end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw) - if not bOk then return false, sErr end - end - return true, sWarn, nNewPhase - end + local bOk, sErr = MakeStandardCuts( Proc, b3Raw, nCuts, dOffsL, TailCutType, Cutting1Data, Cutting2Data, nil, dLenEndRaw) - -- se necessari tagli in doppio, eseguo gli opposti - if bDoubleCut then - -- gli accorciamenti vanno invertiti per il taglio opposto - local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_FRONT, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, sNotes, b3Raw, true) - if not bOk then return false, sErr end - end - end - -- eseguo i tagli necessari - for i = nCuts, 1, -1 do - 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 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 - if bSplit then - sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') - else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') - end - -- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax - if i == nCuts and bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then - sNotes = EgtSetValInNotes( sNotes, 'StartZmax', 2) - end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, sNotes, b3Raw) - if not bOk then return false, sErr end - end - -- altrimenti necessari tagli da sopra e sotto con testa opportuna - else - -- verifico esistenza della lavorazione con lama da sotto - if not sCutting2 then - local sErr = 'Error : cutting H2 not found in library' - EgtOutLog( sErr) - return false, sErr - end - -- verifico che le due lame riescano a lavorare la sezione - local dDimZ = b3Raw:getDimZ() - local dExtra = dMaxVertDepth + dSawMaxDepth2 - dDimZ - if ( dExtra - 2 * BD.CUT_EXTRA_MIN + 10 * GEO.EPS_SMALL < 0) and not bBigSectionCut then - local sErr = 'Error : section too big for tail cut' - EgtOutLog( sErr) - return false, sErr - end - -- calcolo extra taglio ed accorciamento - local dCutExtra = -dSawMaxDepth2 + dExtra / 2 + BD.CUT_EXTRA_MIN - local dCutExtra2 = -dMaxVertDepth + dExtra / 2 + BD.CUT_EXTRA_MIN - local dAccStart = 0 - -- limiti da sotto - local dVzLimDwnUp - if BD.TURN then dVzLimDwnUp = -2 end - -- eseguo i tagli da sotto necessari - for i = nCuts, 1, -1 do - local dCutOffset = ( i - 1) * dOffsL - local sNotes = EgtIf( bSplit, 'Presplit;', 'Precut;') - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting2, dSawDiam2, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw, nil, true) - if not bOk then return false, sErr end - end - -- eseguo i tagli da sopra necessari - for i = nCuts, 1, -1 do - 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 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 - if bSplit then - sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') - else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') - end - local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, sCutting, dSawDiam, MCH_MILL_FU.ORTHO_DOWN, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, 0, sNotes, b3Raw) - if not bOk then return false, sErr end - end - end - return true, nil, nNewPhase -end + return bOk, sErr, nNewPhase +end --------------------------------------------------------------------- return ProcessSplit From 3aefca4613bfa9fa08e1077319c91fc39ebb75e6 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 4 Sep 2024 09:16:24 +0200 Subject: [PATCH 08/14] - In Mark, gestita la lavorazione del testo --- LuaLibs/ProcessMark.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/LuaLibs/ProcessMark.lua b/LuaLibs/ProcessMark.lua index 328279e..a07e321 100644 --- a/LuaLibs/ProcessMark.lua +++ b/LuaLibs/ProcessMark.lua @@ -3,6 +3,7 @@ -- 2020/05/28 Tipo di lavorazione passato da Mark a Text. -- 2021/05/03 Aggiunta gestione testa da sotto. -- 2022/12/05 Aggiunta gestione tipo di lavorazione Text_AT. +-- 2024/09/04 In Make gestione di più geometrie ausiliarie ( ora si lavora anche il testo, oltre che alle linee di marcatura) -- Tabella per definizione modulo local ProcessMark = {} @@ -50,9 +51,6 @@ end --------------------------------------------------------------------- -- Applicazione della lavorazione function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) - -- recupero eventuale geometria ausiliaria - local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') - if AuxId then AuxId = AuxId + Proc.Id end -- recupero i dati della marcatura local vtExtr if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then @@ -108,13 +106,15 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) EgtSetOperationMode( nMchFId, false) return false, sErr end - -- eventuale lavorazione su seconda geometria - if AuxId then + -- si verifica se ci sono altre geometrie da lavorare + local AdditionalGeometries = EgtSplitString( EgtGetInfo( Proc.Id, 'AUXID', 's')) or {} + for i = 1, #AdditionalGeometries do + local AuxId = Proc.Id + AdditionalGeometries[i] -- inserisco la lavorazione di fresatura - local sName2 = 'Decor2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) - local nMchF2Id = EgtAddMachining( sName, sMilling) - if not nMchF2Id then - local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling + local nOtherMachiningId = EgtAddMachining( sName, sMilling) + if not nOtherMachiningId then + sName = 'Decor' .. '_' .. tostring( i) .. '_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) + local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling EgtOutLog( sErr) return false, sErr end @@ -125,14 +125,14 @@ function ProcessMark.Make( Proc, nPhase, nRawId, nPartId) -- eseguo if not ML.ApplyMachining( true, false) then local _, sErr = EgtGetLastMachMgrError() - EgtSetOperationMode( nMchF2Id, false) + EgtSetOperationMode( nOtherMachiningId, false) return false, sErr end -- se geometria a X maggiore, la sposto prima local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT) local ptS2 = EgtSP( AuxId, GDB_ID.ROOT) if ptS2:getX() > ptS1:getX() then - EgtRelocateGlob( nMchF2Id, nMchFId, GDB_IN.BEFORE) + EgtRelocateGlob( nOtherMachiningId, nMchFId, GDB_IN.BEFORE) end end return true From 9dff37f1f4730c3afd8ec90a91a0f95a1d07fbe4 Mon Sep 17 00:00:00 2001 From: "andrea.villa" Date: Wed, 4 Sep 2024 15:54:13 +0200 Subject: [PATCH 09/14] Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato --- LuaLibs/BeamExec.lua | 17 +++++++++++++++++ LuaLibs/ProcessDrill.lua | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 4be9e8b..9d09d61 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -63,6 +63,7 @@ -- 2024/03/13 In CollectFeatures si scrive lunghezza foro su Proc e si controla se serve Predrill -- In OrderFeature, preforo sempre prima del foro -- 2024/04/11 In CollectFeatures aggiunta lettura info PRID, scritta in Proc.FeatureId +-- 2024/09/04 Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato -- Tabella per definizione modulo local BeamExec = {} @@ -1277,6 +1278,20 @@ local function ClassifyFeatures( vProc, b3Raw, Stats) vProc[nSplitting].Down = true bSomeDown = true end + + -- si cerca di riclassificare le feature che dipendono da altre (in caso siano su rotazioni diverse) + for i = 1, #vProc do + local Proc = vProc[i] + -- FORATURA + if Drill.Identify( Proc) and Proc.Dependency then + if Proc.Dependency.ExecBefore then + if Proc.Dependency.ExecBefore.Down then + local bMachiningSideChanged = Drill.Classify( Proc, b3Raw, 'DOWN') + end + end + end + end + return bAllOk, bSomeDown, bSomeSide, bSplitRot end @@ -2012,6 +2027,8 @@ function GetFeatureInfoAndDependency( vProc, b3Raw) -- verifico se feature tipo LapJoint è attraversata da almeno un foro if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove' or Mortise.Identify( Proc)) and Drill.Identify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then Proc.PassedByHole = true + ProcB.Dependency = {} + ProcB.Dependency.ExecBefore = Proc end -- verifico se feature tipo LapJoint è attraversata da almeno una mortasa a coda di rondine if ( Proc.Topology == 'Pocket' or Proc.Topology == 'Tunnel' or Proc.Topology == 'Groove') and DtMortise.SideIdentify( ProcB) and Overlaps( Proc.Box, ProcB.Box) then diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index d79395b..fed7e24 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -22,6 +22,7 @@ -- 2023/11/06 Migliorata gestione dei fori con AngularTransmission. -- 2024/03/13 Aggiunta gestione Predrill -- 2024/03/18 Per Predrill corretta direzione estrusione per fori con direzione verso il basso +-- 2024/09/04 Gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato -- Tabella per definizione modulo local ProcessDrill = {} @@ -213,7 +214,7 @@ end --------------------------------------------------------------------- -- Classificazione della feature -function ProcessDrill.Classify( Proc, b3Raw) +function ProcessDrill.Classify( Proc, b3Raw, sDownOrSideOrStd) -- recupero e verifico l'entità foro local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0 if AuxId then AuxId = AuxId + Proc.Id end @@ -243,6 +244,18 @@ function ProcessDrill.Classify( Proc, b3Raw) local bOpen = ( Proc.Fce ~= 0) local bFaceDown = ( ptCen:getZ() < b3Raw:getMin():getZ() + 2 and (( not Proc.Head and not Proc.Tail) or (( BD.ROT90 or BD.DOWN_HEAD or BD.TURN) and abs( Proc.Flg) == 2))) local bAngTransm = ( BD.ANG_TRASM and ML.FindDrilling( dDiam, nil, nil, nil, nil, true) and AreSameOrOppositeVectorApprox( vtExtr, Z_AX())) + + -- se ci sono delle dipendenze da altre feature da rispettare + if sDownOrSideOrStd then + if sDownOrSideOrStd == 'DOWN' then + if vtExtr:getZ() < - BD.DRILL_VZ_MIN then + Proc.Down = true + return true + end + end + return false + end + -- verifico se il foro è sotto e quindi va spostato o sopra o sul fianco if (( vtExtr:getZ() < BD.DRILL_VZ_MIN or bFaceDown) and ( not bOpen or Proc.Flg ~= 1)) then if not bOpen then From 4fd18d377f26a7316253f32dceb3e49f0d5c6f3a Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 4 Sep 2024 17:52:37 +0200 Subject: [PATCH 10/14] - in split modifiche per precut --- LuaLibs/ProcessSplit.lua | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index cacc585..634418a 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -266,6 +266,10 @@ end --------------------------------------------------------------------- -- split per sezioni grandi con sega a catena o mix catena + lama function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, Cutting2Data) + local sNotes = '' + if SawingData.bSplit ~= nil then + sNotes = 'Precut;' + end local bigSectionSplitType -- se pezzo non troppo alto, taglio singolo da sopra if b3Raw:getDimZ() + BD.CUT_EXTRA_MIN < SawingData.dChainSawMaxMat + 10 * GEO.EPS_SMALL then @@ -284,7 +288,7 @@ function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, -- in base alle scelte precedenti, applico le lavorazioni if bigSectionSplitType == "single horizontal" then local dCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes) -- verifico se sega a catena lunga e devo quindi estendere ingresso e uscita perchè è probabile che non riesca a ruotare sopra al pezzo local bExtendStartEnd local dMinLengthLongChainSaw = 630 @@ -295,28 +299,28 @@ function ProcessSplit.MakeBigSectionSplitting( Proc, b3Raw, dOffset, SawingData, if not bOk then return bOk, sErr end elseif bigSectionSplitType == "single vertical" then local dCutDepth = b3Raw:getDimY() + BD.CUT_EXTRA_MIN - local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + local sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes) local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) if not bOk then return bOk, sErr end elseif bigSectionSplitType == "double vertical" then local dCutDepth = 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN - local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', '') + local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes) local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_BACK, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) if not bOk then return bOk, sErr end - sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', '') + sNotesSplit = EgtIf( SawingData.bSplit, 'Split;', sNotes) bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_FRONT, dCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) if not bOk then return bOk, sErr end elseif bigSectionSplitType == "double horizontal" then -- sega a catena da sopra local dChainSawCutDepth = b3Raw:getDimZ() + BD.CUT_EXTRA_MIN - Cutting2Data.dMaxDepth - local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', '') + local sNotesSplit = EgtIf( SawingData.bSplit, 'Presplit;', sNotes) local bOk, sErr = MakeCutByChainSaw( Proc.Id, SawingData.sSawing, MCH_MILL_FU.PARAL_TOP, dChainSawCutDepth, sNotesSplit, dOffset, nil, SawingData.bInvert) if not bOk then return bOk, sErr end -- lama da sotto local dCutExtra = -dChainSawCutDepth + BD.CUT_EXTRA_MIN local dVzLimDwnUp if BD.TURN then dVzLimDwnUp = -2 end - local sNotes = EgtIf( SawingData.bSplit, 'Split;', '') + local sNotes = EgtIf( SawingData.bSplit, 'Split;', sNotes) local bMaximizeVerticalDepth = true bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra, BD.CUT_SIC, dOffset, 0, 0, sNotes, b3Raw, nil, bMaximizeVerticalDepth) if not bOk then return false, sErr end @@ -359,7 +363,10 @@ end --------------------------------------------------------------------- -- tagli standard local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCutType, Cutting1Data, Cutting2Data, dStartOffset, dLenEndRaw) - local PrecutType = { bBigSectionCut = TailCutType.bBigSectionCut, bHorizCut = TailCutType.bHorizCut, bDoubleHorizCut = TailCutType.bDoubleHorizCut, bDoubleCut = TailCutType.bDoubleCut, bSplit = TailCutType.bSplit, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} + if not TailCutType.sType then + TailCutType.sType = '' + end + local PrecutType = { bBigSectionCut = TailCutType.bBigSectionCut, bHorizCut = TailCutType.bHorizCut, bDoubleHorizCut = TailCutType.bDoubleHorizCut, bDoubleCut = TailCutType.bDoubleCut, bSplit = TailCutType.bSplit, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} if not TailCutType.bDoubleHorizCut then -- flag di lavorazione faccia local nOrthoOpposite = EgtIf( TailCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_BACK) @@ -427,8 +434,10 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut if not bOk then return false, sErr end end -- taglio verticale - local sInfo = 'PreCut;' - if i == 1 then sInfo = 'Cut;' end + local sInfo = 'Precut' + if i == 1 and TailCutType.sType ~= 'Precut' then + sInfo = 'Cut' + end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutXOffset, dAccStart, dAccEnd, sInfo, b3Raw) if not bOk then return false, sErr end end @@ -473,7 +482,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut if TailCutType.bSplit then sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;') end -- se primo taglio da sopra e PF o ONE richiedo risalita preliminare a Zmax if i == nCuts and TailCutType.bHorizCut and BD.C_SIMM and not BD.DOWN_HEAD then @@ -539,7 +548,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut if TailCutType.bSplit then sNotes = EgtIf( i == 1, 'Split;', 'Presplit;') else - sNotes = EgtIf( i == 1, 'Cut;', 'Precut;') + sNotes = EgtIf( i == 1 and TailCutType.sType ~= 'Precut', 'Cut;', 'Precut;') 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, sNotes, b3Raw) if not bOk then return false, sErr end @@ -637,7 +646,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- aggiorno ingombro del grezzo corrente con quello del successivo b3Raw:Add( b3NextRaw) else - dLenEndRaw = 0 + dLenEndRaw = min( dOvmTail, abs( ptC:getX() - b3Raw:getMin():getX())) end end -- determino la necessità di tagli aggiuntivi @@ -647,7 +656,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- dati lavorazioni sopra e sotto local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2} - local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bSplit = bSplit} + local SawingData = { sSawing = sSawing, dChainSawMaxMat = dChainSawMaxMat, dChainSawLen = dChainSawLen, bSplit = bSplit or false} -- dati sul taglio di coda da effettuare local TailCutType = { bBigSectionCut = bBigSectionCut, bHorizCut = bHorizCut, bDoubleHorizCut = bDoubleHorizCut, bDoubleCut = bDoubleCut, bSplit = bSplit, bNeedVerticalAddedCuts = bNeedVerticalAddedCuts, bNeedHorizontalAddedCuts = bNeedHorizontalAddedCuts} -- se taglio per pezzi alti e larghi From b6c5514f9ed798c488b456174ac6ebc7d5081c5e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 4 Sep 2024 18:27:39 +0200 Subject: [PATCH 11/14] - in HeadCut e Split correzioni a pretaglio a zero --- LuaLibs/ProcessHeadCut.lua | 10 +++++----- LuaLibs/ProcessSplit.lua | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index a17856f..40e204a 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -188,7 +188,7 @@ end --------------------------------------------------------------------- -- tagli standard local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCutType, Cutting1Data, Cutting2Data, dStartOffset, dOvmHead) - local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} + local PrecutType = { bBigSectionCut = HeadCutType.bBigSectionCut, bHorizCut = HeadCutType.bHorizCut, bDoubleHorizCut = HeadCutType.bDoubleHorizCut, bDoubleCut = HeadCutType.bDoubleCut, sType = 'Precut', bNeedVerticalAddedCuts = false, bNeedHorizontalAddedCuts = false} if not HeadCutType.bDoubleHorizCut then -- flag di lavorazione faccia local nOrthoOpposite = EgtIf( HeadCutType.bHorizCut, MCH_MILL_FU.ORTHO_DOWN, MCH_MILL_FU.ORTHO_FRONT) @@ -272,7 +272,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and HeadCutType.sType =='Precut' then dCutOffset = dStartOffset end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, MCH_MILL_FU.ORTHO_BACK, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStartDoubleCut, dAccEndDoubleCut, '', b3Raw, true) @@ -287,7 +287,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw) if not bOk then return bOk, sErr end end - if i == 1 and dStartOffset then + if i == 1 and HeadCutType.sType =='Precut' then dCutOffset = dStartOffset end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting1Data.sCutting, Cutting1Data.dSawDiam, nOrthoOpposite, nil, dCutExtra, BD.CUT_SIC, dCutOffset, dAccStart, dAccEnd, '', b3Raw) @@ -326,7 +326,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut -- eseguo i tagli da sotto necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and HeadCutType.sType =='Precut' then dCutOffset = dStartOffset end local bOk, sErr = Fbs.MakeOne( Proc.Id, 0, Cutting2Data.sCutting, Cutting2Data.dSawDiam, MCH_MILL_FU.ORTHO_TOP, dVzLimDwnUp, dCutExtra2, BD.CUT_SIC, dCutOffset, dAccStart, 0, '', b3Raw, nil, true) @@ -335,7 +335,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, HeadCut -- eseguo i tagli da sopra necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and HeadCutType.sType =='Precut' then dCutOffset = dStartOffset end -- se trave larga effettuo tagli verticali aggiuntivi diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index 634418a..cd62b83 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -458,7 +458,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut local dAccStartDoubleCut, dAccEndDoubleCut = dAccEnd, dAccStart for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and TailCutType.sType =='Precut' then dCutOffset = dStartOffset end local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') @@ -475,7 +475,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut local bOk, sErr = AddVerticalPreCuts( Proc, Cutting1Data.sCutting, dCutOffset, b3Raw, sSpecNotes) if not bOk then return bOk, sErr end end - if i == 1 and dStartOffset then + if i == 1 and TailCutType.sType =='Precut' then dCutOffset = dStartOffset end local sNotes @@ -525,7 +525,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut -- eseguo i tagli da sotto necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and TailCutType.sType =='Precut' then dCutOffset = dStartOffset end local sNotes = EgtIf( TailCutType.bSplit, 'Presplit;', 'Precut;') @@ -535,7 +535,7 @@ local function MakeStandardCuts( Proc, b3Raw, nCuts, dOffsetBetweenCuts, TailCut -- eseguo i tagli da sopra necessari for i = nCuts, 1, -1 do local dCutOffset = ( i - 1) * dOffsetBetweenCuts - if i == 1 and dStartOffset then + if i == 1 and TailCutType.sType =='Precut' then dCutOffset = dStartOffset end -- se trave larga effettuo tagli verticali aggiuntivi From 0a767d1afdc6dad3d613fbcc5dc81cec73168cb8 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 5 Sep 2024 12:12:29 +0200 Subject: [PATCH 12/14] - in Headcut e Split aggiunta gestione parametro MIN_HEIGHT_ADDED_CUTS da BeamData per scegliere l'altezza minima per cui devono essere aggiunti i tagli orizzontali supplementari --- LuaLibs/ProcessHeadCut.lua | 2 +- LuaLibs/ProcessSplit.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessHeadCut.lua b/LuaLibs/ProcessHeadCut.lua index 40e204a..a805c87 100644 --- a/LuaLibs/ProcessHeadCut.lua +++ b/LuaLibs/ProcessHeadCut.lua @@ -408,7 +408,7 @@ function ProcessHeadCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bNeedHCut -- verifico necessità di tagli aggiuntivi orizzontali o verticali local dMinOvmHeadForAddeddCuts = 10.123 local bNeedVerticalAddedCuts = ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) - local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) + local bNeedHorizontalAddedCuts = ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and not bBigSectionCut and ( dOvmHead > dMinOvmHeadForAddeddCuts - 10 * GEO.EPS_SMALL) -- dati lavorazioni sopra e sotto local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dMaxDepth2, dSawThick = dSawThick2} diff --git a/LuaLibs/ProcessSplit.lua b/LuaLibs/ProcessSplit.lua index cd62b83..c5dc662 100644 --- a/LuaLibs/ProcessSplit.lua +++ b/LuaLibs/ProcessSplit.lua @@ -652,7 +652,7 @@ function ProcessSplit.Make( Proc, nPhase, nRawId, nPartId, nOrd, sDownOrSideOrSt -- determino la necessità di tagli aggiuntivi local dMinTailScrapForAdditionalCuts = 10.123 local bNeedVerticalAddedCuts = not bSplit and ( Proc.Face[1].WidthTrimmed > BD.MAX_LEN_DICE) and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) - local bNeedHorizontalAddedCuts = not bSplit and ( Proc.Face[1].HeightTrimmed > BD.MAX_LEN_DICE) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) + local bNeedHorizontalAddedCuts = not bSplit and ( Proc.Face[1].HeightTrimmed > ( BD.MIN_HEIGHT_ADDED_CUTS or BD.MAX_LEN_DICE)) and not bBigSectionCut and ( dLenEndRaw > dMinTailScrapForAdditionalCuts - 10 * GEO.EPS_SMALL) -- dati lavorazioni sopra e sotto local Cutting1Data = { sCutting = sCutting, dSawDiam = dSawDiam, dMaxDepth = dSawMaxDepth, dSawThick = dSawThick, dMaxVertDepth = dMaxVertDepth} local Cutting2Data = { sCutting = sCutting2, dSawDiam = dSawDiam2, dMaxDepth = dSawMaxDepth2, dSawThick = dSawThick2} From ec09b3f70c1e8298f54a1c7267e29cdb91725b3e Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 6 Sep 2024 09:11:14 +0200 Subject: [PATCH 13/14] in FacesBySaw -> MakeOne correzione a scelta inversione / lato di lavoro --- LuaLibs/FacesBySaw.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 6a6e0fd..82812cc 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -247,12 +247,12 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw local bIsSawCCW = ( EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0) local bInvert = bForceInvert -- l'inversione può essere comandata da rotazione lama (direzione concorde, legata anche a DownUp) oppure da direzione Z del percorso (si preferisce lavorare dal basso verso l'alto per limitare le corse) - -- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. + -- se c'è disaccordo tra rotazione e direzione si cambia il lato di lavoro, se possibile. Se ciò non è possbile comanda la direzione. Se percorso orizzontale comanda la rotazione. if bInvert == nil then if not BD.TURN or abs( ptP2:getY() - ptP1:getY()) < 250 then local bIsMachiningDownwards = ( ptP2:getZ() < ptP1:getZ() - 100 * GEO.EPS_SMALL) local bIsMachiningUpwards = ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL) - if ( bIsSawCCW ~= bDownUp) and bIsMachiningDownwards then + if ( bIsSawCCW ~= bDownUp) and ( bIsMachiningDownwards or not ( bIsMachiningDownwards or bIsMachiningUpwards)) then bInvert = true elseif ( ( bIsSawCCW ~= bDownUp) ~= bIsMachiningDownwards) then if Par5Alternative then From af8017097634eaef3ad63dc72d177b044c26b9ae Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 9 Sep 2024 14:27:25 +0200 Subject: [PATCH 14/14] update log e versione --- UpdateLog.txt | 10 ++++++++++ Version.lua | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/UpdateLog.txt b/UpdateLog.txt index e0ad921..17457f9 100644 --- a/UpdateLog.txt +++ b/UpdateLog.txt @@ -1,5 +1,15 @@ ==== Beam Update Log ==== +Versione 2.6i1 (09/09/2024) +- Added : refactoring e modifiche a HeadCut e Split per introduzione pretagli a zero sul grezzo, per evitare problemi con pezzi non lunghi quanto ci si aspetta +- Added : in Mark, gestita la lavorazione del testo +- Modif : gestione dipendenza foro-tasca in caso di fase con pezzo ribaltato +- Modif : in Headcut e Split aggiunta gestione parametro MIN_HEIGHT_ADDED_CUTS da BeamData per scegliere l'altezza minima per cui devono essere aggiunti i tagli orizzontali supplementari +- Modif : se Lapjoint attraversata da L055, la lapjoint viene fatta prima +- Modif : in ScarfJoint, in dicing, tagli paralleli fatti con unico passaggio di fianco per evitare che il cubetto rimanga appoggiato al motore +- Fixed : corretto caso di groove lunga passante a 3 facce che non veniva lavorata +- Fixed : in FacesBySaw -> MakeOne corretta gestione lato di lavoro quando il percorso è orizzontale + Versione 2.6h2 (26/08/2024) - Added : in BatchProcess e New si verifica l'abilitazione alla generazione con EgtVerifyKeyOption - Modif : in FacesBySaw introdotti attacchi tangenziali solo da un lato, limitati a facce con Z negative diff --git a/Version.lua b/Version.lua index 8bb89ed..3d09079 100644 --- a/Version.lua +++ b/Version.lua @@ -2,5 +2,5 @@ -- Gestione della versione di Beam NAME = 'Beam' -VERSION = '2.6h2' -MIN_EXE = '2.6h1' +VERSION = '2.6i1' +MIN_EXE = '2.6e5'