diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index 1b82beb..292a5e5 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -1,4 +1,4 @@ --- DiceCut.lua by Egaltech s.r.l. 2021/01/21 +-- DiceCut.lua by Egaltech s.r.l. 2021/02/02 -- Gestione dei piano paralleli nei tagli lunghi: equidistanziamento dei piani paralleli -- Tabella per definizione modulo @@ -461,7 +461,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl else for PlnInd = 1, #TabellaTmSurfP do -- piano interno - local ptCInner, vtNInner = EgtSurfTmFacetCenter( TabellaTmSurfP[PlnInd], 0, GDB_ID.ROOT) + local ptCInner, vtNInner = EgtSurfTmFacetCenter( TabellaTmSurfP[PlnInd], 0, GDB_ID.ROOT) -- eventuale piano esterno local ptCOuter, vtNOuter = nil, nil if PlnInd > 1 then @@ -480,7 +480,7 @@ function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPl vtO = -vtO end else - if ptCInner:getX() > BBoxRawPart:getCenter():getX() then + if vtNInner:getX() > -0.017 then if vtO:getX() < 0 then vtO = - vtO end else if vtO:getX() > 0 then vtO = - vtO end diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 4c16b21..5d99c4b 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -16,7 +16,9 @@ local BD = require( 'BeamData') local ML = require( 'MachiningLib') --------------------------------------------------------------------- -function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutName) +function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutName, bUpdateIng) + -- bUpdateIng : parametro opzionale con default true + if bUpdateIng == nil then bUpdateIng = true end -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) -- ingombro del pezzo @@ -148,7 +150,7 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutName) end -- eventuale segnalazione ingombro di testa o coda local dMinHIng = min( 0.5 * BD.VICE_MINH, 0.5 * b3Raw:getDimZ()) - if Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then + if bUpdateIng and Proc.Box:getDimZ() > dMinHIng and Proc.Box:getMin():getZ() < b3Raw:getMin():getZ() + dMinHIng then if Proc.Head then local dOffs = b3Solid:getMax():getX() - Proc.Box:getMin():getX() BL.UpdateHCING( nRawId, dOffs) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 8f574b3..8c7cd8f 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2021/01/20 +-- ProcessCut.lua by Egaltech s.r.l. 2021/02/02 -- Gestione calcolo singoli tagli di lama per Travi -- Tabella per definizione modulo @@ -188,13 +188,13 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, EgtOutLog( sErr) return false, sErr end - local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) -- dati geometrici del taglio local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + -- limiti di taglio (se molto di lato e inclinati sono permessi fino a -45deg) + local dNzLimDwnUp = BL.GetNzLimDownUp( b3Raw) + if not BD.C_SIMM and abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end local bDownCut = ( vtN:getZ() <= dNzLimDwnUp) if bFromBottom == nil then bFromBottom = ( b3Solid:getDimX() < BD.LEN_SHORT_PART and vtN:getZ() > 0.25) end - local bFillAreaPiece - local bFillTail -- se taglio di testa if Proc.Head then -- se coincide con il taglio di separazione precedente, non va fatto @@ -213,6 +213,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, return true end -- se pezzo ancora attaccato alla trave, per non rovinare quello successivo + local bFillAreaPiece + local bFillTail if not BL.IsSplittedPartPhase( nPhase) then -- se non da sotto if not bDownCut then @@ -294,7 +296,8 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, local dMaxVertDepth = dMaxDepth - ( BD.DECR_VERT_CUT or 0) -- determino la direzione di taglio preferenziale local _, dCutH, dCutV = BL.GetFaceHvRefDim( Proc.Id, 0) - local bHorizCut = (( dCutV < dMaxVertDepth - BD.CUT_EXTRA and dCutH > dMaxDepth - BD.CUT_EXTRA) and not bDownCut) + local bHorizCut = ( dCutV < dMaxVertDepth - BD.CUT_EXTRA and not bDownCut) + --local bHorizCut = (( dCutV < dMaxVertDepth - BD.CUT_EXTRA and dCutH > dMaxDepth - BD.CUT_EXTRA) and not bDownCut) -- verifico se necessari tagli supplementari EgtOutLog( string.format( 'MaxDepth=%.1f MaxVertDepth=%.1f CutH=%.1f CutV=%.1f', dMaxDepth, dMaxVertDepth, dCutH, dCutV), 3) local vCuts = {} @@ -432,8 +435,6 @@ function ProcessCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, bFromBottom, end -- altrimenti tagli diretti della faccia else - -- tagli molto di lato e inclinati sono permessi fino a -45deg - if abs( vtN:getX()) < 0.5 then dNzLimDwnUp = -0.707 end -- lavoro la faccia local vtOrthoO if bFromBottom and dCutV < dMaxVertDepth - BD.CUT_EXTRA and vtN:getZ() > 0 then diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index 906890f..ec627fa 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/12/25 +-- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/22/02 -- Gestione calcolo doppi tagli di lama per Travi -- Tabella per definizione modulo @@ -266,7 +266,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- altrimenti, tagli diretti delle facce else - local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide')) + local bOk, sErr = Fbs.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, EgtIf( bHead, 'HeadSide', 'TailSide'), false) if not bOk then return bOk, sErr end @@ -275,14 +275,23 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) -- eventuale segnalazione ingombro di testa o coda (se non convesso, altrimenti già fatto nei tagli singoli) if not bConvex then if Proc.Head then - local dOffs = b3Raw:getMax():getX() - dOvmHead - Proc.Box:getMin():getX() - if vtNm:getZ() > 0.5 then - dOffs = 0.4 * dOffs - elseif abs( vtNm:getZ()) > 0.35 then - dOffs = 0.75 * dOffs + -- intersezioni con linee a metà altezza appena dentro dal davanti e dal dietro + local ptRef = b3Raw:getCenter() - 0.5 * b3Raw:getDimX() * X_AX() + local ptL1 = ptRef - ( 0.5 * b3Raw:getDimY() - 0.1) * Y_AX() + local ptL2 = ptRef + ( 0.5 * b3Raw:getDimY() - 0.1) * Y_AX() + local bInt1, IntTy1, IntPar1 = EgtLineSurfTmInters( ptL1, X_AX(), Proc.Id, GDB_ID.ROOT) + local bInt2, IntTy2, IntPar2 = EgtLineSurfTmInters( ptL2, X_AX(), Proc.Id, GDB_ID.ROOT) + local dMinPar = b3Raw:getDimX() + if IntPar1 and #IntPar1 > 0 then + dMinPar = min( dMinPar, IntPar1[1]) end + if IntPar2 and #IntPar2 > 0 then + dMinPar = min( dMinPar, IntPar2[1]) + end + local dOffs = b3Raw:getDimX() - dMinPar BL.UpdateHCING( nRawId, dOffs) elseif Proc.Tail then + -- accetto approssimazione più grezza local dOffs = Proc.Box:getMax():getX() - b3Solid:getMin():getX() if vtNm:getZ() > 0.5 then dOffs = 0.4 * dOffs diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 9607069..22ae9fa 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,7 +1,8 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2021/01/31 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/02/03 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. +-- 2021/02/03 Corretto riconoscimento feature di coda. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -437,7 +438,8 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) return not bHead end -- verifico se è in coda - if Proc.Box:getMin():getX() > b3Raw:getMin():getX() + BD.MAX_DIST_HTFEA then + local dEndDist = Proc.Box:getMin():getX() - b3Raw:getMin():getX() + if dEndDist > BD.MAX_DIST_HTFEA then return false end -- la sua lunghezza non deve superare il massimo e 60% della lunghezza della trave @@ -459,8 +461,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) if vtN and vtN:getZ() < BD.NZ_MINA and nFacInd2 then ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) nFacInd, nFacInd2 = nFacInd2, nFacInd + dElev, dElev2 = dElev2, dElev end - if not vtN or vtN:getX() > -0.499 then + if not vtN or vtN:getX() > -0.001 or dEndDist + vtN:getX() * dElev > 0 then return false else return true