From b921e1345d3a34cf3a3ef5f9948169dab6454d34 Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 27 May 2022 11:50:41 +0200 Subject: [PATCH] DataBeam : - migliorie in LapJoint per U passanti da testa a coda e divise in parti - correzioni e migliorie in LongDoubleCut per casi con facce ortogonali tra loro e allineate con i piani XY e XZ. --- LuaLibs/ProcessLapJoint.lua | 83 +++++++++++++++++++++++++++----- LuaLibs/ProcessLongDoubleCut.lua | 19 +++++--- 2 files changed, 84 insertions(+), 18 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 399a1c7..e83491b 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -3229,7 +3229,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) +local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRoughTool, sMasterPocket, dPrevFaceElev, tDimAndRef, dAng, bOpenOutRaw) -- calcolo l'elevazione dal punto medio local dElev @@ -3332,6 +3332,9 @@ local function MakePocket( Proc, nPartId, ptPs, tvtN, nFaceRef, sMchFind, nUseRo -- imposto elevazione e dichiaro non si generano sfridi per VMill local sNotes = 'MaxElev=' .. EgtNumToString( dElev, 1) .. ';' sNotes = sNotes .. 'VMRS=0;' + if bOpenOutRaw then + sNotes = sNotes .. 'OpenOutRaw=1;' + end EgtSetMachiningParam( MCH_MP.USERNOTES, sNotes) if not ML.ApplyMachining( true, false) then -- provo ad allargare leggermente la tasca @@ -4341,7 +4344,7 @@ local function ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, end --------------------------------------------------------------------- -local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill) +local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePart, bPrevBhSideMill, bAllWithEndCap) local sWarn -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) @@ -4822,14 +4825,16 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- settaggio voluto da Alessandro/Fabio (per fare angoli con fresa piccola) sMchFind = 'Pocket' local dDiam = min( dH, dV) - local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail) + local bTailOnSide = ( Proc.Box:getMin():getX() - b3Solid:getMin():getX() < 0.1 and not Proc.Tail and not bAllWithEndCap) if ( Proc.Fct == 1) or (( Proc.Fct == 2 or Proc.Fct == 3) and bIsL) or ((( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 4 and not bTailOnSide)) and bSinglePart) then sMchFind = 'OpenPocket' if bIsU then dDiam = GetUShapeWidth( Proc, nFacInd) or dDiam elseif Proc.Fct == 4 then - -- per rifinire gli angoli premio utensile diam 25 o da BD - dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) + -- se non angoli fittizi, per rifinire gli angoli premio utensile diam 25 o da BD + if not bAllWithEndCap then + dDiam = min( dDiam, BD.MAXDIAM_POCK_CORNER or 30) + end elseif Proc.Fct == 3 and bIsL then -- per rifinire gli angoli premio utensile diam 25 o da BD dDiam = min( 2 * dDiam, BD.MAXDIAM_POCK_CORNER or 30) @@ -5244,7 +5249,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) + bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, 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 @@ -5339,8 +5344,34 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) end -- recupero l'ingombro del grezzo di appartenenza local b3Raw = EgtGetRawPartBBox( nRawId) + -- ottengo la distanza tra la fine del pezzo e il pezzo successivo + local dDistToNextPiece = EgtGetInfo( nRawId, 'BDST', 'd') or BD.OVM_MID + -- verifico se applicare gestione speciale delle giunzioni (U diretta come asse X) + local bAddEndCap = false + local dAddLen = 0 + local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) + if bIsU then + local ptC0, vtN0 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) + local ptC1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) + local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT) + if vtN0:getX() < 0.0175 and vtN1:getX() < 0.0175 and vtN2:getX() < 0.0175 then + local dWidth = 0 + if vtN0 * vtN1 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC1 - ptC0) * vtN0 + elseif vtN0 * vtN2 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC2 - ptC0) * vtN0 + elseif vtN1 * vtN2 < -0.9998 then + bAddEndCap = true + dWidth = ( ptC2 - ptC1) * vtN1 + end + dAddLen = min( dWidth, 100) / 2 + end + end -- la divido in parti lungo X local vAddId = {} + local bAllWithEndCap = bAddEndCap local nPart = max( ceil( Proc.Box:getDimX() / BD.LONGCUT_MAXLEN), 2) local dPartLen = Proc.Box:getDimX() / nPart local Xmin = Proc.Box:getMin():getX() @@ -5348,13 +5379,43 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) -- eseguo divisione local AddId = EgtCopyGlob( Proc.Id, nAddGrpId) or GDB_ID.NULL EgtSetName( AddId, 'AddPart_' .. tostring( Proc.Id) .. '_' .. tostring( i)) - if i > 1 then - local ptOn = Point3d( Xmin + ( i - 1) * dPartLen, 0, 0) - EgtCutSurfTmPlane( AddId, ptOn, -X_AX(), true, GDB_RT.GLOB) + if i > 1 or bAddEndCap then + -- definizione del piano + local dAdd = EgtIf( i > 1, dAddLen, 0) + local ptOn = Point3d( Xmin - dAdd + ( i - 1) * dPartLen, 0, 0) + local vtN = -X_AX() + -- se richiesto, creazione tappo + local CapId + if bAddEndCap then + local nFirstId, nPnt, nCrv, nSrf = EgtPlaneSurfTmInters( ptOn, vtN, AddId, nAddGrpId, GDB_RT.GLOB) + if nPnt == 0 and nCrv == 1 and nSrf == 0 then + EgtCloseCurveCompo( nFirstId) + CapId = EgtSurfTmByFlatContour( nAddGrpId, nFirstId) + if not CapId then bAllWithEndCap = false end + end + if nFirstId then + for nId = nFirstId, nFirstId + nPnt + nCrv + nSrf - 1 do + EgtErase( nId) + end + end + end + -- taglio della superficie + EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) + -- se esiste, aggiunta del tappo + if CapId then + AddId = EgtSurfTmBySewing( nAddGrpId, { AddId, CapId}) + -- se prima spezzatura, allungamento per non lasciare archi + if i == 1 then + local b3Box = EgtGetBBoxGlob( AddId, GDB_BB.STANDARD) + local dCoeffX = 1 + min( dAddLen, dDistToNextPiece) / b3Box:getDimX() + EgtScale( AddId, Frame3d( b3Box:getMax()), dCoeffX, 1, 1, GDB_RT.GLOB) + end + end end if i < nPart then local ptOn = Point3d( Xmin + i * dPartLen, 0, 0) - EgtCutSurfTmPlane( AddId, ptOn, X_AX(), true, GDB_RT.GLOB) + local vtN = X_AX() + EgtCutSurfTmPlane( AddId, ptOn, vtN, true, GDB_RT.GLOB) end -- eseguo inserimento in modo da ordinare da X+ a X- table.insert( vAddId, 1, AddId) @@ -5368,7 +5429,7 @@ local function MakeLongMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead) local AddProc = { Id = vAddId[i], Grp = Proc.Grp, Prc = Proc.Prc, Box = b3Box, TotBox = Proc.Box, Fct = nFct, Flg = Proc.Flg} -- lasciare il false nel sesto parametro (perchè internamente viene verificato se diverso da nil) local bOk, sMyWarn - bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, false, bPrevBhSideMill) + bOk, sMyWarn, bPrevBhSideMill = MakeMoreFaces( AddProc, nPhase, nRawId, nPartId, dOvmHead, bAllWithEndCap, bPrevBhSideMill, bAllWithEndCap) if not sWarn then sWarn = sMyWarn end if not bOk then return bOk, sWarn end end diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index f380f79..2acca11 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/03/20 +-- ProcessLongDoubleCut.lua by Egaltech s.r.l. 2022/05/27 -- Gestione calcolo doppio taglio longitudinale per Travi -- 2021/05/18 Possibile taglio con lama anche di fianco su macchina con testa da sotto. -- 2021/06/29 Corretta gestione caso equivalente a due smussi. @@ -7,6 +7,7 @@ -- 2022/02/08 Sistemate lunghezze fresature quando due sole. -- 2022/02/15 Sistemati commenti. -- 2022/03/20 Tolta da scelta milling tipo Long2CutDown controllo max diametro fresa. +-- 2022/05/27 Corretto ordine per casi sui lati. -- Tabella per definizione modulo local ProcessLong2Cut = {} @@ -294,9 +295,9 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster -- verifico posizione (+1=sopra, -1=sotto, 0=sui lati) local nSide = 0 - if vtN[1]:getZ() > -10 * GEO.EPS_SMALL and vtN[2]:getZ() > -10 * GEO.EPS_SMALL then + if vtN[1]:getZ() > 0.0175 and vtN[2]:getZ() > 0.0175 then nSide = 1 - elseif vtN[1]:getZ() < 10 * GEO.EPS_SMALL and vtN[2]:getZ() < 10 * GEO.EPS_SMALL then + elseif vtN[1]:getZ() < -0.0175 and vtN[2]:getZ() < -0.0175 then nSide = -1 end @@ -372,7 +373,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster vOrd = EgtIf( ptC[1]:getY() < ptRef:getY(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestParalOpposite( ptC[1] - ptM), BL.GetNearestParalOpposite( ptC[2] - ptM)} else - local bFront = ( vtN[1]:getY() < 0) + local bFront = ( vtN[1]:getY() < 0 or vtN[2]:getY() < 0) if bFront then vOrd = EgtIf( ptC[1]:getZ() < ptRef:getZ(), { 1, 2}, { 2, 1}) vFaceUse = { BL.GetNearestOrthoOpposite( ptC[1] - ptM), BL.GetNearestOrthoOpposite( ptC[2] - ptM)} @@ -898,10 +899,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end - -- se la fine (a sinistra) non è limitata e ho un pezzo successivo più distante da metà raggio. setto la fine come limitata - if dDistToNextPiece < dToolDiam/2 and nFaceLimit < 2 then + -- se ho un pezzo successivo più distante di metà raggio : setto la fine come limitata + if dDistToNextPiece < dToolDiam/2 then bForcedLim = true - nFaceLimit = nFaceLimit + 2 + nFaceLimit = nFaceLimit | 2 end -- se chiuso e corto, applico svuotatura con fresa opportuna if nFaceLimit == 3 and Proc.Box:getDimX() < 2 * dToolDiam then @@ -1022,6 +1023,10 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end end end + if nIni == 2 then + dStartDist, dEndDist = dEndDist, dStartDist + dStartAccDist, dEndAccDist = dEndAccDist, dStartAccDist + end -- ciclo sulle parti local nM = 0 for j = 1, nC do