From 903638adeac507409528a17245f4972fae6205d6 Mon Sep 17 00:00:00 2001 From: DarioS Date: Thu, 29 Apr 2021 09:02:35 +0200 Subject: [PATCH] DataWall : - sistemazione varie per macchina NZ. --- BatchProcess.lua | 6 ++++-- LuaLibs/WProcessCut.lua | 2 +- LuaLibs/WProcessFreeContour.lua | 22 ++++++++++++++++++++-- LuaLibs/WProcessLapJoint.lua | 17 ++++++++++++++++- LuaLibs/WallExec.lua | 20 ++++++++++++++++++++ LuaLibs/WallLib.lua | 16 ++++++++++++---- Process.lua | 6 ++++-- 7 files changed, 77 insertions(+), 12 deletions(-) diff --git a/BatchProcess.lua b/BatchProcess.lua index 50d5902..e6c16ca 100644 --- a/BatchProcess.lua +++ b/BatchProcess.lua @@ -301,6 +301,8 @@ if bToProcess then if abs( dInvAng - 0) < GEO.EPS_ANG_SMALL then if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() + elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL then + vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() end elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() @@ -311,8 +313,8 @@ if bToProcess then vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() - elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then - vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() + --elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then + -- vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() elseif abs( dRotAng - 90) < GEO.EPS_ANG_SMALL or abs( dRotAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() end diff --git a/LuaLibs/WProcessCut.lua b/LuaLibs/WProcessCut.lua index 6d3d000..2be55df 100644 --- a/LuaLibs/WProcessCut.lua +++ b/LuaLibs/WProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2020/11/13 +-- WProcessCut.lua by Egaltech s.r.l. 2020/11/13 -- Gestione calcolo taglio di testa o longitudinale per Pareti -- Tabella per definizione modulo diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 89724d9..ce294b5 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1187,6 +1187,7 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd dOriDepth = dDepth -- lo limito e tolgo eventuali Tabs dDepth = dMaxDepth + if abs( vFace[i].SideAng) > 15 then dDepth = dDepth - 20 end EgtSetMachiningParam( MCH_MP.LEAVETAB, false) bNotThrou = true end @@ -1212,6 +1213,15 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd if #vFace == 1 then dSal = -dMillDiam / 2 dEal = -dMillDiam / 2 + -- se lavorazione completa su faccia singola + elseif vFace[OrigI].Type == 4 then + if vFace[OrigI].PrevAng < -30 then + dSal = -dMillDiam / 2 + end + local OrigK = EgtIf( OrigI < #vFace, OrigI + 1, EgtIf( bClosed, 1, nil)) + if OrigK and vFace[OrigK].PrevAng < -30 then + dEal = -dMillDiam / 2 + end end -- se non devo scaricare l'angolo if nConeCut <= 1 then @@ -1571,8 +1581,8 @@ local function MakeByCut( Proc, nRawId, b3Raw) local vtExtr= EgtCurveExtrusion( AuxId, GDB_RT.GLOB) if vtExtr then bOpposite = ( Proc.Grp == 4 and vtExtr:getZ() < 0) or ( Proc.Grp == 3 and vtExtr:getZ() > 0) + if vtExtr:getZ() < 0 then bNegZ = true end end - if vtExtr:getZ() < 0 then bNegZ = true end end -- altezza massima delle facce local dWidth = 0 @@ -1597,11 +1607,19 @@ local function MakeByCut( Proc, nRawId, b3Raw) -- inserimento dei tagli di lama local bCtOk, sCtErr = AddCuts( sCutting, vFace, Proc, nRawId, b3Raw, dSawThick) if not bCtOk then return bCtOk, sCtErr end + -- se ci sono facce inclinate, escludo la sega a catena + local bSlanting = false + for i = 1, #vFace do + if abs( vFace[i].Norm:getZ()) > 0.01 then + bSlanting = true + break + end + end -- recupero la lavorazione con sega a catena local sSawing = WM.FindSawing( 'Sawing') -- recupero la lavorazione di fresatura local sMilling, dMillMaxDepth = WM.FindMilling( 'FreeContour', dMaxWidth + WD.CUT_EXTRA) - if not sMilling and not sSawing then + if not sMilling and ( not sSawing or bSlanting) then sMilling = WM.FindMilling( 'FreeContour') if not sMilling then local sErr = 'Error : milling not found in library' diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 0d4d3cc..bd4ae79 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1,4 +1,4 @@ --- WProcessLapJoint.lua by Egaltech s.r.l. 2021/04/22 +-- WProcessLapJoint.lua by Egaltech s.r.l. 2021/04/28 -- Gestione calcolo mezzo-legno per Pareti -- Tabella per definizione modulo @@ -1450,6 +1450,21 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) -- eseguo la svuotatura return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) end + -- se una delle due facce rivolta verso il basso + elseif vtN[1]:getZ() < -0.001 or vtN[2]:getZ() < -0.001 then + -- cerco la faccia rivolta verso l'alto + local nFacet + if vtN[1]:getZ() > 0 then + nFacet = 0 + elseif vtN[2]:getZ() > 0 then + nFacet = 1 + else + local sErr = 'Error feature with 2 faces facing down' + EgtOutLog( sErr) + return false, sErr + end + -- eseguo la svuotatura + return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) end -- ordino i tagli per fare prima quello meno inclinato local nOrd = { 0, 1} diff --git a/LuaLibs/WallExec.lua b/LuaLibs/WallExec.lua index 86a52d1..bcde431 100644 --- a/LuaLibs/WallExec.lua +++ b/LuaLibs/WallExec.lua @@ -20,6 +20,8 @@ local WD = require( 'WallData') _G.package.loaded.WMachiningLib = nil _G.package.loaded.WallLib = nil _G.package.loaded.WProcessCut = nil +_G.package.loaded.WProcessDoubleCut = nil +_G.package.loaded.WProcessSawCut = nil _G.package.loaded.WProcessLapJoint = nil _G.package.loaded.WProcessDrill = nil _G.package.loaded.WProcessMortise = nil @@ -30,6 +32,8 @@ _G.package.loaded.WProcessFreeContour = nil local WM = require( 'WMachiningLib') local WL = require( 'WallLib') local Cut = require( 'WProcessCut') +local DoubleCut = require( 'WProcessDoubleCut') +local SawCut = require( 'WProcessSawCut') local LapJoint = require( 'WProcessLapJoint') local Drill = require( 'WProcessDrill') local Mortise = require( 'WProcessMortise') @@ -168,6 +172,14 @@ local function ClassifyFeatures( vProc, b3Raw) if Cut.Identify( Proc) then local bOk = Cut.Classify( Proc, b3Raw) if not bOk then Proc.Flg = 0 end + -- se taglio doppio + elseif DoubleCut.Identify( Proc) then + local bOk = DoubleCut.Classify( Proc, b3Raw) + if not bOk then Proc.Flg = 0 end + -- se taglio con lama + elseif SawCut.Identify( Proc) then + local bOk = SawCut.Classify( Proc, b3Raw) + if not bOk then Proc.Flg = 0 end -- se tasca elseif LapJoint.Identify( Proc) then local bOk = LapJoint.Classify( Proc, b3Raw) @@ -221,6 +233,14 @@ local function AddFeatureMachining( Proc, nRawId, b3Raw) if Cut.Identify( Proc) then -- esecuzione taglio bOk, sErr = Cut.Make( Proc, nRawId, b3Raw) + -- se taglio doppio (1/2-011-X) o taglio doppio longitudinale (0-012-X) + elseif DoubleCut.Identify( Proc) then + -- esecuzione taglio + bOk, sErr = DoubleCut.Make( Proc, nRawId, b3Raw) + -- se taglio con lama (0/3/4-013-X) + elseif SawCut.Identify( Proc) then + -- esecuzione taglio + bOk, sErr = SawCut.Make( Proc, nRawId, b3Raw) -- se tasca (3/4-030-X) o similari elseif LapJoint.Identify( Proc) then -- esecuzione tasca diff --git a/LuaLibs/WallLib.lua b/LuaLibs/WallLib.lua index 0d6cdd8..b6cba11 100644 --- a/LuaLibs/WallLib.lua +++ b/LuaLibs/WallLib.lua @@ -76,11 +76,19 @@ function WallLib.GetFaceElevation( nSurfId, nFac, nRawId) local frOCS = Frame3d( ptC, vtN) ; local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS) local dElev = b3Box:getMax():getZ() - if nPartId then + if nRawId then local _, dCenElev = WallLib.GetPointDirDepth( nRawId, ptC, vtN) - if dCenElev and dCenElev > dElev then - dElev = dCenElev - end + if dCenElev and dCenElev > dElev then dElev = dCenElev end + local dOffsX = min( 20, b3Box:getDimX() / 4) + local _, dP1Elev = WallLib.GetPointDirDepth( nRawId, ptC + dOffsX * frOCS:getVersX(), vtN) + if dP1Elev and dP1Elev > dElev then dElev = dP1Elev end + local _, dP2Elev = WallLib.GetPointDirDepth( nRawId, ptC - dOffsX * frOCS:getVersX(), vtN) + if dP2Elev and dP2Elev > dElev then dElev = dP2Elev end + local dOffsY = min( 20, b3Box:getDimY() / 4) + local _, dP3Elev = WallLib.GetPointDirDepth( nRawId, ptC + dOffsY * frOCS:getVersY(), vtN) + if dP3Elev and dP3Elev > dElev then dElev = dP3Elev end + local _, dP4Elev = WallLib.GetPointDirDepth( nRawId, ptC - dOffsY * frOCS:getVersY(), vtN) + if dP4Elev and dP4Elev > dElev then dElev = dP4Elev end end return dElev end diff --git a/Process.lua b/Process.lua index 17e9af0..a714921 100644 --- a/Process.lua +++ b/Process.lua @@ -131,6 +131,8 @@ local function MyProcessInputData() if abs( dInvAng - 0) < GEO.EPS_ANG_SMALL then if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() + elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL then + vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() end elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() @@ -141,8 +143,8 @@ local function MyProcessInputData() vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX() if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY() - elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then - vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() + --elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then + -- vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() elseif abs( dRotAng - 90) < GEO.EPS_ANG_SMALL or abs( dRotAng + 270) < GEO.EPS_ANG_SMALL then vWall[i].PosX = vWall[i].PosX + vWall[i].Box:getDimX() end