From ea5c64e82f9ef10f60664284e0685f72ee2abef6 Mon Sep 17 00:00:00 2001 From: DarioS Date: Wed, 13 Jul 2022 00:36:57 +0200 Subject: [PATCH] DataBeam : - in ProcessDril modifica a ricalcolo MaxElev quando distanza circa 0 - in ProcessLapJoint sistemato orientamento lama - in ProcessScarfJoint aggiunta gestione PF1250 e TURN - in ProcessTenon migliorata scelta punto iniziale. --- LuaLibs/ProcessDrill.lua | 4 ++-- LuaLibs/ProcessLapJoint.lua | 45 ++++++++++++++++++----------------- LuaLibs/ProcessScarfJoint.lua | 27 ++++++++++++++------- LuaLibs/ProcessTenon.lua | 2 +- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/LuaLibs/ProcessDrill.lua b/LuaLibs/ProcessDrill.lua index 543a2bb..e73cd59 100644 --- a/LuaLibs/ProcessDrill.lua +++ b/LuaLibs/ProcessDrill.lua @@ -413,9 +413,9 @@ function ProcessDrill.Make( Proc, nPhase, nRawId, nPartId) if dMaxDepth == 0 then dMaxDepth = dMaxDepthOri end - if dHoleToCutDistance > 0 then + if dHoleToCutDistance > 10 * GEO.EPS_SMALL then dMaxElev = dLen - dHoleToCutDistance - elseif dHoleToCutDistance < 0 then + elseif dHoleToCutDistance < -10 * GEO.EPS_SMALL then dMaxElev = -dHoleToCutDistance end local dToolAddLength = dLen - dMaxElev diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index a65ee88..c519364 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -2847,12 +2847,15 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, local dMaxLen = 0 for i = 1, #vAdj do if vAdj[i] >= 0 then - local _, ptP1, ptP2, _ = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) - local dLen = dist( ptP1, ptP2) - if dLen > dMaxLen then - nFacAdj = vAdj[i] - dMaxLen = dLen - EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, dH, dV), 3) + local vtAdjN = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], GDB_ID.ROOT) + if not bIs3Faces or abs( rfFac:getVersZ():getY()) < 0.174 or abs( rfFac:getVersZ():getY()) > 0.984 or vtAdjN:getY() * rfFac:getVersZ():getY() > 0.1 then + local _, ptP1, ptP2 = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) + local dLen = dist( ptP1, ptP2) + if dLen > dMaxLen then + nFacAdj = vAdj[i] + dMaxLen = dLen + EgtOutLog( string.format( 'Adjac=%d Len=%.3f H=%.3f V=%.3f', vAdj[i], dLen, dH, dV), 3) + end end end end @@ -2991,7 +2994,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, -- se la lunghezza utensile non riesce ad arrivare sul fondo assegno la possibilità di lavorare di fianco (se possibile) if dElev > dMaxDepth + 10 * GEO.EPS_SMALL then -- continuo di testa se fessura con tre facce o non è tunnel - bGoFromHead = ( bIs3Faces or not bOrthoFaces) + bGoFromHead = (( bIs3Faces and dMaxElev) or not bOrthoFaces) end -- se continuo a lavorare di testa if bGoFromHead then @@ -4527,25 +4530,23 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- dati della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) -- larghezza della faccia - local dV = 0 - local dH = 0 + local _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) + if Proc.Box:getDimX() > Proc.Box:getDimY() then + if dH > dV then dH, dV = dV, dH end + else + if dH < dV then dH, dV = dV, dH end + end -- se due o più facce (recupero la larghezza della faccia perpendicolarmente alle altre) if Proc.Fct >= 2 then local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, EgtIf( nFacInd == 0, 1, 0), GDB_ID.ROOT) local vtX = vtN2 ^ vtN - local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2) - local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, nFacInd, GDB_BB.STANDARD, frRef) - if b3Ref then - dH = b3Ref:getDimX() - dV = b3Ref:getDimY() - end - -- altrimenti una sola faccia - else - _, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - if Proc.Box:getDimX() > Proc.Box:getDimY() then - if dH > dV then dH, dV = dV, dH end - else - if dH < dV then dH, dV = dV, dH end + if not vtX:isSmall() then + local frRef = Frame3d( ptC, ptC + 100 * vtX, ptC + 100 * vtN2) + local b3Ref = EgtSurfTmGetFacetBBoxRef( Proc.Id, nFacInd, GDB_BB.STANDARD, frRef) + if b3Ref then + dH = b3Ref:getDimX() + dV = b3Ref:getDimY() + end end end -- verifico se U diff --git a/LuaLibs/ProcessScarfJoint.lua b/LuaLibs/ProcessScarfJoint.lua index cb00fcf..4a44ef6 100644 --- a/LuaLibs/ProcessScarfJoint.lua +++ b/LuaLibs/ProcessScarfJoint.lua @@ -1,7 +1,8 @@ --- ProcessScarfJoint.lua by Egaltech s.r.l. 2021/06/28 +-- ProcessScarfJoint.lua by Egaltech s.r.l. 2022/07/12 -- 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) +-- 2022/07/12 Aggiunta gestione PF1250 e TURN. -- Tabella per definizione modulo local ProcessScarfJoint = {} @@ -27,6 +28,10 @@ end --------------------------------------------------------------------- -- Classificazione della feature function ProcessScarfJoint.Classify( Proc) + -- se PF con testa da sotto o TURN, ammessa qualunque orientazione + if ( BD.C_SIMM and BD.DOWN_HEAD) or BD.TURN then + return true + end -- verifico le normali delle facce local nFacetCnt = EgtSurfTmFacetCount( Proc.Id) for i = 1, nFacetCnt do @@ -127,10 +132,10 @@ end --------------------------------------------------------------------- local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Solid, ptC, vtN, Proc, vtRef, bHead, sCutting, dSawDiam, b3Raw, dNewDiceDim) - local vCuts = {} local bOk = true local sErr = '' + local vCuts = {} if nGoodFace1 and nGoodFace4 and nGoodFace1 > 0 and nGoodFace4 > 0 then -- lavoro solo la faccia inclinata perché la faccia tappo completa la lavoro successivamente -- questo evita di lavorare due volte la faccia tappo @@ -139,6 +144,8 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli vCuts = DC.GetDice( nAddGrpId, b3Solid, ptC[vFaceOrd[4]], vtN[vFaceOrd[4]], true, nil, nil, nil, dNewDiceDim) end + local dVzLimDwnUp = EgtIf( vtRef:getZ() < -0.017, -2, nil) + if #vCuts > 0 then -- sistemo posizione nel DB e nome for i = 1, #vCuts do @@ -174,7 +181,7 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli 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, nil, dExtraCut, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + 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 @@ -182,14 +189,14 @@ local function ApplyDiceCut( vFaceOrd, nGoodFace1, nGoodFace4, nAddGrpId, b3Soli if vFaceOrd[1] ~= 0 then -- inserisco la lavorazione local vtOrthoO = Vector3d( vtRef) - bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + bOk, sErr = Fbs.MakeOne( Proc.Id, vFaceOrd[1] - 1, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end end -- lavoro la faccia opposta (definita dal parametro P11) 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, nil, 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + local 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 @@ -290,8 +297,12 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa local bOkc, sErrC = MakeChamfer( Proc, nPhase, nRawId, nPartId, dOvmHead) if not bOkc then return bOkc, sErrC end + -- abilitazione lavorazione da sotto (testa da sotto e direzione normale sotto -20deg) + local bDownHead = ( BD.DOWN_HEAD and vtRef:getZ() < -0.01) + local bTopHead = ( BD.DOWN_HEAD and ( vtRef:getZ() > -0.01 or not bDownHead)) + -- recupero la lavorazione - local sCutting = ML.FindCutting( 'HeadSide') + local sCutting = ML.FindCutting( 'HeadSide', bTopHead, bDownHead) if not sCutting then local sErr = 'Error : cutting not found in library' EgtOutLog( sErr) @@ -441,9 +452,9 @@ function ProcessScarfJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead, dOvmTa -- recupero la lavorazione. considerando l dimensione del lato e l'affondamento local sPocketing if dDistFaces then - sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces) + sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, dDistFaces, nil, bTopHead, bDownHead) else - sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax) + sPocketing = ML.FindPocketing( 'OpenPocket', dDiamMax, nil, nil, bTopHead, bDownHead) end if not sPocketing then diff --git a/LuaLibs/ProcessTenon.lua b/LuaLibs/ProcessTenon.lua index b5226ba..f2224ca 100644 --- a/LuaLibs/ProcessTenon.lua +++ b/LuaLibs/ProcessTenon.lua @@ -202,7 +202,7 @@ function ProcessTenon.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local OVERLAP_COEFF = 0.7 -- porto inizio curva il più possibile sul bordo in alto o in basso local dMaxDist = OVERLAP_COEFF * dMillDiam * MAX_PASS - local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999) + local bMyShortPart = ( bShortPart and abs( vtN:getX()) < 0.999 and abs( vtN:getY()) < 0.259) BL.PutStartNearestToEdge( AuxId, b3Solid, dMaxDist, bH2 ~= bMyShortPart) -- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente local sWarn