From afb57f7e92b65ec4b90c84251bb23074afe20931 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Thu, 16 Jun 2022 18:25:02 +0200 Subject: [PATCH] DataBeam: -Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeByPockets, Classify. --- LuaLibs/ProcessLapJoint.lua | 51 +++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 74e36cc..4ebf1af 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -43,6 +43,7 @@ -- 2022/05/04 Corretta classificazione due facce sotto. Modificati criteri assegnazione due facce alla coda. -- 2022/05/24 Miglioramenti vari per BH, compreso controlli per lavorazione da sotto. -- 2022/06/13 Modifiche per feature lunga con due facce non equivalenti a taglio long. doppio o singolo con faccia terminale. +-- 2022/06/16 Implemento lavorazioni con fresatura di lato per L30 (al momento solo passanti) se parametro Q03=2. Modificate funzioni Make, MakeByPockets, Classify. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -720,7 +721,9 @@ function ProcessLapJoint.Classify( Proc, b3Raw) 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)) - bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN) + -- per L30, se forzata la lavorazione con fresa di lato da parametro Q03=2 non devo ruotare + local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2) + bDown = ( bDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill) return true, bDown -- se più di 2 facce else @@ -818,7 +821,12 @@ function ProcessLapJoint.Classify( Proc, b3Raw) local bDown = ( vtN:getZ() < BD.NZ_MINA and not BD.DOWN_HEAD and not BD.TURN) -- se verso il basso, verifico se utilizzabile seconda faccia if bDown then - if nFacInd2 and dElev2 < 2 * dElev then + local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) + -- per lapjoint proc 30, se forzata la lavorazione con fresa di lato da parametro Q03=2 non devo ruotare + local bForceSideMill = ( Proc.Prc == 30 and EgtGetInfo( Proc.Id, 'Q03', 'd') == 2 and Proc.Fct == 3 and bIsU) + if bForceSideMill then + bDown = false + elseif nFacInd2 and dElev2 < 2 * dElev then local ptC2, vtN2 = EgtSurfTmFacetCenter( Proc.Id, nFacInd2, GDB_ID.ROOT) bDown = ( vtN2:getZ() < BD.NZ_MINB) elseif not nFacInd2 and bIsL and nFaceAdj >= 0 then @@ -3550,7 +3558,7 @@ local function GetUShapeWidth( Proc, nFacInd) end --------------------------------------------------------------------- -local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown) +local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMchFindMaster, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders) local nFirstMachId local bOrthoFaces @@ -3608,8 +3616,8 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha -- e assegno l'estrusione nPathInt = EgtExtractSurfTmLoops( nSurfInt, nAddGrpId) EgtModifyCurveExtrusion( nPathInt, vtOrtho, GDB_RT.GLOB) - -- se ho 3 facce, ciclo sulle entià del percorso per segnare quelle che sono aperte - if bIs3Faces then + -- se ho 3 facce oppure se forzato, ciclo sulle entià del percorso per segnare quelle che sono aperte. + if bIs3Faces or bSetOpenBorders then SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId) end -- variabili per parametri lavorazione @@ -4541,6 +4549,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bIsU = ( Proc.Fct == 3 and not TestElleShape3( Proc)) -- verifico se due facce o L con una o due facce di terminazione local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) + local bForceSideMill = Proc.Prc == 30 and EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') == 2 and ( ( Proc.Fct == 3 and bIsU) or ( Proc.Fct == 2)) -- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc, bIsU, bIsL, bSinglePart, bPrevBhSideMill) if bPrevBhSideMill == nil then @@ -4774,9 +4783,9 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa dFacElev, dFacElev2 = dFacElev2, dFacElev bUseOtherFace = true end - -- verifico non sia orientata verso il basso o ci sia una testa dal basso + -- verifico non sia orientata verso il basso o ci sia una testa dal basso o la lavorazione sia dal lato. local bFaceDown = ( vtN:getZ() < BD.NZ_MINA) - if bFaceDown and not BD.DOWN_HEAD and not BD.TURN then + if bFaceDown and not BD.DOWN_HEAD and not BD.TURN and not bForceSideMill then local sErr = 'Error : LapJoint from bottom impossible' EgtOutLog( sErr) return false, sErr @@ -4986,14 +4995,18 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa if Proc.Prc == 16 and bForceUseBlade and Proc.Fct == 3 and bIsU then sPocketing = nil end + -- se richiesta fresatura di lato + if bForceSideMill then + sPocketing = nil + end -- leggo parametro Q local nQAntisplintResult = EgtGetInfo( Proc.Id, Q_ANTISPLINT_TYPE, 'i') or 0 - -- se lavorazione fresa come lama disabilito eveentuale antischegggia + -- se lavorazione fresa come lama disabilito eventuale antischeggia if bSpecialMillOnSide then nQAntisplintResult = 0 end -- se non trova una svuotatura adatta if not sPocketing then -- se forma a L provo con contornatura - if bIsL and not bSpecialMillOnSide then + if bIsL and not bSpecialMillOnSide and not bForceSideMill then -- se smusso non è esclusivo if nChamfer < 2 then return MakeByMill( Proc, nPhase, nRawId, nPartId, nFacInd, rfFac, dH, dV, dFacElev, dCollSic) @@ -5105,16 +5118,26 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa bMadeASbyBld, bOk, sWarn = ManageAntiSplintBySaw( Proc, b3Raw, bIsU, vtN, nFacInd, sWarn, bSawDown, true) if not bOk then return false, sWarn end end - -- in base al flag interno e al numero di facce e se ha forma ad U: provo prima la svuotatura sul fianco e + -- in base al flag interno e al numero di facce e se ha forma ad U + -- oppure se richiesta lavorazione di lato: + -- provo prima la svuotatura sul fianco e -- se non è possibile allora provo in seguito con lama o segacatena -- o passare subito dalla lavorazione con lama/sega catena - if bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU then + if ( bTrySidePocketAtFirst and Proc.Fct == 3 and bIsU) or bForceSideMill then -- lavoro con svuotature (singola o doppia contrapposta) local sMyMchFind = 'Pocket' local dDiamTool = 100 local nPathInt, nSurfInt, bOneShot, nFirstMachId + local bIs3Faces = true + local bOrthoFacesMaster = nil + local bSetOpenBorders = nil + if Proc.Fct == 2 or bForceSideMill then + bIs3Faces = false + bOrthoFacesMaster = true + bSetOpenBorders = true + end nOk, sErr, dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, dDiamTool, bDoubleSide, nPathInt, nSurfInt, bOneShot, bMillDown, nFirstMachId, - bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, true, b3Solid, nil, bMillDown) + bOrthoFaces = MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCham, nAddGrpId, sMyMchFind, bIs3Faces, b3Solid, bOrthoFacesMaster, bMillDown, bSetOpenBorders) if nOk == -2 then if not sMchFind then sMchFind = sMchFindBackUp @@ -5133,7 +5156,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa bTryWithBlades = false sWarn = sErr -- se ho antischeggia con fresa le inserisco --- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then + -- if nChamfer < 2 and nQAntisplintResult == 2 and ( bIsU or bIsL) then if nChamfer < 2 and nQAntisplintResult == 2 then local bOk, sWarn2 = ManageAntiSplintByMill( Proc, nPhase, nRawId, nPartId, b3Raw, nFacInd, nAddGrpId, bMillDown, dDiamTool, bDoubleSide, @@ -5483,7 +5506,7 @@ function ProcessLapJoint.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local nUseRoughToolOnSide = EgtGetInfo( Proc.Id, Q_SIDE_ROUGH_TOOL, 'i') or 0 nForceUseBladeOnNotContinueFace = EgtGetInfo( Proc.Id, Q_BLADE_ON_ALONG_FACE, 'i') or 0 -- se antischeggia di fresa o abilitato sgrossatore di fianco - if nBladeAntisplint == 2 or nUseRoughToolOnSide == 1 then + if nBladeAntisplint == 2 or nUseRoughToolOnSide > 0 then bUseBlade = false end -- se ho attivo la lama e ho la feature 32, verifico i parametri Q propri della feature