diff --git a/LuaLibs/BeamExec.lua b/LuaLibs/BeamExec.lua index 4633774..d9eeb9a 100644 --- a/LuaLibs/BeamExec.lua +++ b/LuaLibs/BeamExec.lua @@ -1,4 +1,4 @@ --- BeamExec.lua by Egaltech s.r.l. 2022/09/24 +-- BeamExec.lua by Egaltech s.r.l. 2022/09/28 -- 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. @@ -36,6 +36,7 @@ -- 2022/08/08 Modifica per macchine senza BD.MAX_WIDTH2 e BD.MAX_HEIGHT2. -- 2022/08/18 Aggiunta gestione macchine con testa da sotto con lama da sotto disabilitata. -- 2022/09/21 Nella funzione di ordinamento il foro del birdsmouth viene sempre fatto prima della lavorazione stessa +-- 2022/09/28 I fori vengono sempre fatti prima delle tacche. -- Tabella per definizione modulo local BeamExec = {} @@ -321,6 +322,8 @@ local function CollectFeatures( PartId, b3Raw, dCurrOvmH, dCurrOvmT) Proc2.Fce = Proc.Fcs Proc2.CutId = Proc.CutId Proc2.TaskId = Proc.TaskId + Proc2.AdjId = Proc.AdjId + Proc2.MainId = Proc.MainId table.insert( vProc, Proc2) end -- se BlockHaus HalfLap @@ -651,7 +654,7 @@ end local function OrderFeatures( vProc, b3Raw) local dDrillPenalty = EgtIf( BD.PRESS_ROLLER, 200, 100) - local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, 200, 600) + local dSmallDrillRange = EgtIf( b3Raw:getDimX() < BD.LEN_SHORT_PART, BD.DRILL_RANGE_SP or 200, BD.DRILL_RANGE or 600) -- funzione di confronto -- secondo centro box in X (taglio di intestazione prima di altri tagli di testa e taglio di separazione però prima di altri tagli di coda) @@ -680,12 +683,14 @@ local function OrderFeatures( vProc, b3Raw) if B1.Head ~= B2.Head then return B1.Head end - -- se primo è foro di un birdsmouth e secondo è il suo birdsmouth, il foro va sempre prima - if Drill.Identify(B1) and LapJoint.Identify(B2) and B1.MainId == B2.Id then + -- se primo è foro e secondo è un ribasso, il foro va sempre prima + if Drill.Identify(B1) and LapJoint.Identify(B2) and + B1.Box:getCenter():getX() > B2.Box:getMin():getX() and B1.Box:getCenter():getX() < B2.Box:getMax():getX() then return true end - -- se primo è birdsmouth e secondo è il suo foro, il birdsmouth va sempre dopo - if LapJoint.Identify(B1) and Drill.Identify(B2) and B1.AdjId == B2.Id then + -- se primo è un ribasso e secondo è un foro, il ribasso va sempre dopo + if LapJoint.Identify(B1) and Drill.Identify(B2) and + B2.Box:getCenter():getX() > B1.Box:getMin():getX() and B2.Box:getCenter():getX() < B1.Box:getMax():getX() then return false end -- se entrambi tenoni e si intersecano, metto prima tenone vero e poi base tenone diff --git a/LuaLibs/DiceCut.lua b/LuaLibs/DiceCut.lua index f8c5162..32d0a9e 100644 --- a/LuaLibs/DiceCut.lua +++ b/LuaLibs/DiceCut.lua @@ -377,12 +377,13 @@ end -- ptCBond*: il punto centrale della superfice limitante (se non esistono altre superfici può essere omesso) -- vtNBond*: il versore normale della superfice limitante (se non esistono altre superfici può essere omesso) -- dOrthoMaxDim : massima profondità taglio se faccia singola perpendicolare facce laterali trave --- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE +-- dCustMaxDimDice: dimensione massima customizzata, sostituisce il parametro BD.MAX_DIM_DICE (se negativa qualunque, se positiva deve stare nel MAX) -- bDownHead : taglio con testa da sotto ---------------------------------------------------------------------------------------------------------------------------------------------------- function DiceCut.GetDice( nParent, BBoxRawPart, ptCPlanes, vtNPlanes, bGetOrtoPlanes, ptCBond, vtNBond, dOrthoMaxDim, dCustMaxDimDice, bDownHead) - local dMaxDimDice = EgtIf( dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE, dCustMaxDimDice, BD.MAX_DIM_DICE) + local dMaxDimDice = BD.MAX_DIM_DICE + if dCustMaxDimDice and dCustMaxDimDice < BD.MAX_DIM_DICE then dMaxDimDice = abs( dCustMaxDimDice) end local dTolerance = 0 -- distanza di sicurezza per i tagli ortogonali local OffsetP = dMaxDimDice -- distanza tra i piani paralleli local StepP = 100 -- numero massimo di piani paralleli da generare diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 249f4cf..93c8e47 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -1,4 +1,4 @@ --- ProcessCut.lua by Egaltech s.r.l. 2022/07/28 +-- ProcessCut.lua by Egaltech s.r.l. 2022/09/30 -- Gestione calcolo singoli tagli di lama per Travi -- 2021/05/18 I due tagli con testa da sotto di un cubetto sono fatti di seguito. -- 2021/06/06 Correzioni per tagli con testa da sotto. @@ -353,9 +353,29 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b vtExtra = X_AX() bAutoCalcSurf = false end + -- verifico elevazione max del materiale tagliato + local dMaxElev + if vtN:getX() > 0 then + dMaxElev = b3Solid:getMax():getX() - Proc.Box:getMin():getX() + else + dMaxElev = Proc.Box:getMax():getX() - b3Solid:getMin():getX() + end + -- per macchina TURN aggiusto massima dimensione cubetto + local dNewDiceDim + if BD.TURN then + local dDimRef = GEO.INFINITO + if abs( vtN:getZ()) < 0.003 then + dDimRef = b3Raw:getDimZ() + elseif abs( vtN:getY()) < 0.003 then + dDimRef = b3Raw:getDimY() + end + if dDimRef + BD.CUT_EXTRA < dMaxDepth then + dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA) + end + end -- se il taglio è più spesso della lama abilito il dicing, altrimenti no - if Proc.Box:getDimX() >= dSawThick then - vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA) + if dMaxElev > dSawThick then + vCuts = DC.GetDice( nAddGrpId, EgtIf( bForced, b3Raw, b3Solid), ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, dNewDiceDim) -- se taglio sborda in coda e non è stato inserito nessun taglio a cubetti, lo rilancio con le dimensioni customizzate if ( bFillTail or bCustDiceCut) and #vCuts == 0 then vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC, vtN, bAutoCalcSurf, ptExtra, vtExtra, dMaxVertDepth - BD.CUT_EXTRA, Proc.Box:getDimY()) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index aff82b1..2b8ff49 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2022/07/05 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2022/09/27 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -54,6 +54,7 @@ -- 2022/09/15 Implementata gestione feature Planing L090, gestita come LapJoint -- Implementata, in caso di fresatura di lato con altezza tasca molto bassa, la contornatura con unica passata -- Migliorata gestione AntiSplint (Mill e Saw) +-- 2022/09/27 Aggiunta gestione SCC per svuotature con TURN (solo dopo applicazione lavorazione). -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -3001,7 +3002,7 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe end --------------------------------------------------------------------- -local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) +local function MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) -- calcolo l'elevazione dal punto medio local dElev @@ -3119,6 +3120,24 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo return false, sErr end end + if BD.TURN then + -- centro del pezzo + local ptCen = ORIG() + if b3Solid then ptCen = b3Solid:getCenter() end + -- punto inizio lavorazione + local ptStart = EgtGetMachiningStartPoint() or ORIG() + -- orientamento braccio + local nSCC = MCH_SCC.NONE + -- se faccia verso alto o basso + if abs( tvtN[2]:getZ()) > abs( tvtN[2]:getY()) then + nSCC = EgtIf( ptStart:getY() > ptCen:getY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_YM) + -- altrimenti faccia verso davanti o dietro + else + nSCC = EgtIf( ptStart:getZ() > ptCen:getZ(), MCH_SCC.ADIR_ZP, MCH_SCC.ADIR_ZM) + end + EgtSetMachiningParam( MCH_MP.SCC, nSCC) + ML.ApplyMachining( true, false) + end return true, sWarn, sTuuidPk, dDiamTool, dDepth end @@ -3144,7 +3163,7 @@ local function MachineByMill( Proc, nPhase, nRawId, nPartId, b3Solid, tvtN, nBas -- se l'angolo dalla verticale si discosta di più dell'angolo limite impostato, utilizzo la svuotatura if cos( dDiffFromSqAng) < cos( dAngLimit) then -- applico la svuotatura - local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) + local bOk, sWarn, sTuuidPk, dDiamTool, dElev = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtN, nSideFace, sMchFind, nUseRoughTool, sPocketing, dPrevFaceElev, tDimAndRef, dAng) if not bOk then -- se ho id utensile e diametro è perchè non ha fatto svuotatura perchè la faccia è più stretta del diametro utensile -- e provo ad inserire singola passata di testa @@ -5145,7 +5164,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dToolMaxDiam = min ( dFacDim1, dFacDim2, dToolTargetDiam) end local _, sPocketing = VerifyPocket( Proc, dToolMaxDiam, dFacElev, nil, sMyMchFind) - bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) + bOk, sWarn2, sTuuidPk, dDiamTool, dDepth = MakePocket( Proc, nPartId, b3Solid, ptPs, tvtNx, nFacInd, sMyMchFind, nUseRoughTool, sPocketing, dMachDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end @@ -5327,7 +5346,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local tvtNx = {} tvtNx[2] = vtN local bOk, sWarn2 - bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap) + bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, b3Solid, ptC, tvtNx, nFacInd, sMchFind, nUseRoughTool, sPocketing, dFacElev + dCollSic, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index f54cabf..71bb9e4 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -1,4 +1,4 @@ --- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12 +-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/09/30 -- Gestione calcolo giunto Gerber per Travi -- 2021/06/28 Aggiunto extra-taglio alle lamate orizzontali. -- 2022/06/10 Aggiunto il parametro dOvmTail per gestire sovramateriali in coda diversi da OVM_MID (sezioni alte e larghe) @@ -173,7 +173,11 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli if vtO then vtOrthoO = Vector3d( vtO) else - vtOrthoO = Y_AX() + if vtN[vFaceOrd[4]]:getZ() < 0.1 then + vtOrthoO = Z_AX() + else + vtOrthoO = Y_AX() + end end end end @@ -310,10 +314,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa end -- recupero i dati dell'utensile local dSawDiam = 400 + local dMaxDepth = 0 if EgtMdbSetCurrMachining( sCutting) then local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end @@ -346,7 +352,6 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa EgtOutLog( sErr) return false, sErr end - -- se esistono faccia interna ed intermedia, verifico se richiedono taglio a cubetti nGoodFace1 = EgtSurfTmFacetCount( nFace1) nGoodFace4 = EgtSurfTmFacetCount( nFace4) @@ -356,21 +361,27 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa nGoodFace1 = EgtSurfTmFacetCount( nFace1) end - local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw) + -- per macchina TURN aggiusto massima dimensione cubetto + local dNewDiceDim + if BD.TURN and nGoodFace4 and nGoodFace4 > 0 then + local dDimRef = EgtIf( abs( vtN[vFaceOrd[4]]:getZ()) < 0.1, b3Raw:getDimZ(), b3Raw:getDimY()) + if dDimRef + BD.CUT_EXTRA < dMaxDepth then + dNewDiceDim = - ( dMaxDepth - BD.CUT_EXTRA) + end + end + + local bOkd, sErrD, vCuts = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) if not bOkd then return bOkd, sErrD end if #vCuts == 0 then -- se ho la faccia intermedia, per prima cosa verifico se ho intersezione con la faccia tappo if nGoodFace4 ~= 0 then - -- taglio sulla faccia interna - if vFaceOrd[1] ~= 0 then - -- inserisco la lavorazione - local vtOrthoO = Vector3d( vtRef) - bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOkd then return bOkd, sErrD end - end -- se non ho intersezione con la faccia tappo posso fare il taglio sul fianco if not nGoodFace1 or nGoodFace1 == 0 then + -- inserisco la lavorazione + local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX())) + bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOkd then return bOkd, sErrD end -- lavoro la faccia opposta (definita dal parametro P11) if vFaceOrd[3] ~= 0 then -- inserisco la lavorazione @@ -378,16 +389,20 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[3] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) if not bOkd then return bOkd, sErrD end end - -- inserisco la lavorazione - local vtRef2 = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, Z_AX(), EgtIf( bHead, Y_AX(), -Y_AX())) - bOkd, sErrD = Fbs.MakeOne( nFace4, nGoodFace4 - 1, sCutting, dSawDiam, vtRef2, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) - if not bOkd then return bOkd, sErrD end - else -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole + -- altrimenti se ho intersezione forzo il DiceCut ad essere eseguito con distanze più piccole + else -- definisco la nuova dimensione massima del dice cut local dNewDiceDim = EgtIf( abs(vtRef:getZ()) < GEO.EPS_SMALL, b3Raw:getDimZ(), b3Raw:getDimY()) bOkd, sErrD = ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) if not bOkd then return bOkd, sErrD end end + -- taglio sulla faccia interna + if vFaceOrd[1] ~= 0 then + -- inserisco la lavorazione + local vtOrthoO = Vector3d( vtRef) + bOkd, sErrD = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOkd then return bOkd, sErrD end + end else -- taglio sulla faccia interna if vFaceOrd[1] ~= 0 then