diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index e100eb6..9dc9dcf 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2021/12/20 +-- BeamExec.lua by Egaltech s.r.l. 2022/05/04 -- Libreria esecuzione lavorazioni per Travi -- 2019/07/11 Aggiunta gestione stato rotazione di feature per TS3. -- 2019/09/04 Corretto controllo feature di testa e coda con sovramateriale di testa elevato. @@ -25,6 +25,7 @@ -- 2021/11/27 House mortise sempre prima di (dt)mortise, house tenon sempre dopo (dt)tenon. -- 2021/12/15 Corretta CompareFeature (risultato deve essere simmetrico scambiando le feature). -- 2021/12/20 Ulteriore correzione a CompareFeature (caso con entrambe senza geometria). +-- 2022/05/04 Nell'ordinamento quando si confrontano i box delle feature aggiunta verifica preliminare della loro validità. -- Tabella per definizione modulo local BeamExec = {} @@ -657,10 +658,13 @@ local function OrderFeatures( vProc, b3Raw) end for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 40 then + if ProcI.Prc == 40 and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] - if ProcJ.Prc == 40 and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and + if ProcJ.Prc == 40 and + ProcJ.Box and not ProcJ.Box:isEmpty() and + ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and abs( ProcJ.Diam - ProcI.Diam) < 1.0 and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dDrillRange then if j > i + 1 then local ProcK = vProc[i+1] @@ -694,10 +698,12 @@ local function OrderFeatures( vProc, b3Raw) local dMarkRange = 300 for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959 then + if ( ProcI.Prc == 60 or ProcI.Prc == 61 or ProcI.Prc == 959) and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] if ( ProcJ.Prc == 60 or ProcJ.Prc == 61 or ProcJ.Prc == 959) and + ProcJ.Box and not ProcJ.Box:isEmpty() and ProcJ.Head == ProcI.Head and ProcJ.Tail == ProcI.Tail and abs( ProcJ.Box:getCenter():getX() - ProcI.Box:getCenter():getX()) < dMarkRange then if j > i + 1 then @@ -712,10 +718,13 @@ local function OrderFeatures( vProc, b3Raw) local dBHHLRange = 100 for i = 1, #vProc do local ProcI = vProc[i] - if ProcI.Prc == 37 then + if ProcI.Prc == 37 and + ProcI.Box and not ProcI.Box:isEmpty() then for j = i + 1, #vProc do local ProcJ = vProc[j] - if ProcJ.Prc == 37 and abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then + if ProcJ.Prc == 37 and + ProcJ.Box and not ProcJ.Box:isEmpty() and + abs( ProcI.Box:getCenter():getX() - ProcJ.Box:getCenter():getX()) < dBHHLRange then if ProcI.HeadDir then if ProcJ.vtN:getY() < -0.5 then table.insert( vProc, i, table.remove( vProc, j)) diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 2dbb682..7d16652 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2022/04/05 +-- BeamLib.lua by Egaltech s.r.l. 2022/05/03 -- Libreria globale per Travi -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. @@ -10,6 +10,7 @@ -- 2021/09/12 Aggiustamenti in GetNearestParalOpposite e GetNearestOrthoOpposite. -- 2022/01/11 In GetNearest*Opposite ridotto vantaggio XY rispetto a Z da 1 -> 0.9 a 1 -> 0.99. -- 2022/04/05 Modifiche a GetNzLimDownUp per FAST. +-- 2022/05/03 Ulteriore limitazione a GetNzLimDownUp per FAST. -- Tabella per definizione modulo local BeamLib = {} @@ -695,7 +696,7 @@ function BeamLib.GetNzLimDownUp( b3Raw, vtN, vtOrtho) if b3Raw:getDimZ() < 200 then return -0.5 elseif b3Raw:getDimZ() < BD.MIN_DIM_HBEAM then - return -0.258 + return -0.240 else return -0.174 end diff --git a/LuaLibs/ProcessDtMortise.lua b/LuaLibs/ProcessDtMortise.lua index 1dc409a..de29e1a 100644 --- a/LuaLibs/ProcessDtMortise.lua +++ b/LuaLibs/ProcessDtMortise.lua @@ -1,4 +1,4 @@ --- ProcessDtMortise.lua by Egaltech s.r.l. 2022/03/23 +-- ProcessDtMortise.lua by Egaltech s.r.l. 2022/05/01 -- Gestione calcolo mortase a coda di rondine per Travi -- 2021/04/08 Aggiunto controllo massimo materiale lavorabile dalla fresa. -- 2021/04/08 Miglioria scelta lavorazione in presenza di testa da sotto. @@ -91,8 +91,6 @@ local function CalcTopPath( nProcId, AuxId, nAddGrpId, dAltMort, dSideAng, b3Sol local NewAuxId = EgtCopyGlob( AuxId, nAddGrpId) if not NewAuxId then return end -- ne allungo gli estremi - --EgtExtendCurveStartByLen( NewAuxId, 100) - --EgtExtendCurveEndByLen( NewAuxId, 100) EgtAddCurveCompoLineTg( NewAuxId, 100, false) EgtAddCurveCompoLineTg( NewAuxId, 100, true) EgtMergeCurvesInCurveCompo( NewAuxId) @@ -150,7 +148,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) return false, sErr end -- determino l'altezza della mortasa (0=faccia di fondo) - local rfDtMrt = Frame3d( ptBC, vtExtr) + local rfDtMrt, dLenMrt, dWidthMrt = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_RT.GLOB) local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt) local dAltMort = b3DtMrt:getDimZ() -- verifico se di tipo pocket @@ -395,7 +393,7 @@ function ProcessDtMortise.Make( Proc, nPhase, nRawId, nPartId, dCurrOvmH) local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB) vtAx:normalize() local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx - local dDist = vtOrtDiff:len() + local dDist = min( vtOrtDiff:len(), dWidthMrt) -- calcolo le passate local nPass = ceil( dDist / ( 1.9 * dToolDiam)) local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 6b1d313..5c12c40 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/04/28 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/05/04 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -40,6 +40,7 @@ -- 2022/03/21 Quando si usa lama uso Q10 come massima elevazione. -- 2022/03/29 Aggiunta gestione antischeggia con Q06 anche su 3/4-033-X. -- 2022/04/28 Lavorazione BH forzata sempre OneWay. +-- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -606,7 +607,7 @@ end function ProcessLapJoint.IsTailFeature( Proc, b3Raw) -- se una sola faccia if Proc.Fct == 1 then - local _, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + local vtN0 = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) if vtN0:getX() < -0.1 then return true end @@ -617,7 +618,6 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) local bUseBHSideMill, bHead, bHeadDir = VerifyBHSideMill( Proc) if bUseBHSideMill then Proc.HeadDir = bHeadDir - --return not bHead end -- recupero box del pezzo local nPartId = EgtGetParent( EgtGetParent( Proc.Id) or GDB_ID.NULL) @@ -627,8 +627,9 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) if dEndDist > BD.MAX_DIST_HTFEA then return false end - -- la sua lunghezza non deve superare il massimo e 60% della lunghezza della trave - if Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Raw:getDimX()) then + -- se lunga come trave, oppure non è trave corta e la sua lunghezza supera il massimo o il 60% della lunghezza della trave + if Proc.Box:getDimX() > b3Solid:getDimX() - 1 or + ( b3Solid:getDimX() > BD.LEN_SHORT_PART and Proc.Box:getDimX() > min( BD.MAX_LEN_HTFEA, 0.6 * b3Solid:getDimX())) then return false end -- se una o due facce e interessa veramente la coda, allora di coda @@ -660,7 +661,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) -- se 1 faccia if Proc.Fct == 1 then -- dati della faccia - local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + --local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) -- verifico se è lavorabile solo dal basso --local bDown = ( vtN:getZ() < BD.NZ_MINA) --return true, bDown @@ -673,13 +674,14 @@ function ProcessLapJoint.Classify( Proc, b3Raw) return true, false end -- dati delle facce - local ptC = {} local vtN = {} - ptC[1], vtN[1] = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - ptC[2], vtN[2] = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) + vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT) + vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT) -- verifico se è lavorabile solo dal basso + local vtParX = vtN[1] ^ vtN[2] ; vtParX:normalize() + local bParX = ( abs( vtParX:getX()) > 0.985) local bSmall = ( ( Proc.Head or Proc.Tail) and Proc.Box:getDimX() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) or - ( not ( Proc.Head or Proc.Tail) and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) + ( not ( Proc.Head or Proc.Tail) and bParX and Proc.Box:getDimY() <= BD.GetMaxLenRidgeLapFromBottom( b3Raw:getDimZ())) local bDown = ( vtN[1]:getZ() < BD.NZ_MINB and vtN[2]:getZ() < BD.NZ_MINB) or ( vtN[1]:getZ() < BD.NZ_MINA and vtN[2]:getZ() < 0.5 and ( vtN[2]:getZ() < -0.1 or not bSmall)) or ( vtN[2]:getZ() < BD.NZ_MINA and vtN[1]:getZ() < 0.5 and ( vtN[1]:getZ() < -0.1 or not bSmall)) @@ -4395,6 +4397,12 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa bClosedOrthoFaces = false -- non setto come tunnel end end + -- se proviene da divisione in parti lungo X ed è un tunnel non è fattibile + if not bSinglePart and bClosedOrthoFaces then + local sErr = 'Error : long splitted tunnel not feasible' + EgtOutLog( sErr) + return false, sErr + end -- verifico se sono presenti i parametri Q per la profondità smusso e -- per eseguire in esclusiva solo lo smusso local nChamfer, dDepthCham, sErrCham, bForceUseBlade = EvaluateQParam( Proc) diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index d013981..0d7d12c 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -318,7 +318,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- analisi del taglio local vOrd = {} local vFaceUse = {} - if nSide == 1 or ( nSide == -1 and BD.DOWN_HEAD) then + if nSide == 1 or ( nSide == -1 and ( BD.DOWN_HEAD or BD.TURN)) then vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} elseif nSide == -1 then @@ -368,7 +368,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- verifico se posso usare lame local bCanUseBlade, bCanUseUnderBlade = CalcBladeUse( bUseBlade, BD.DOWN_HEAD, nSide, vtN[1], vtN[2], bConvex) -- introduco messaggi di errore in caso sia settata la lama ma impossibile utilizzarla - -- se si toglie questa parte il processo continua utilizzandi però la fresa ma per il vincolo del parametro Q non è possibile + -- se si toglie questa parte il processo continua utilizzando però la fresa ma per il vincolo del parametro Q non è possibile if bUseBlade and not BD.DOWN_HEAD and not bCanUseBlade then local sErr = 'Error, impossible use blade on too negative face' EgtOutLog( sErr)