From 9bca31c9217060f02873ef34b58dcf1ce01f6dc0 Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 17 May 2021 20:34:51 +0200 Subject: [PATCH] DataBeam : - in gestione LapJoint semplificata gestione diametro minimo utensile per svuotatura --- LuaLibs/ProcessLapJoint.lua | 104 +++++++----------------------------- 1 file changed, 18 insertions(+), 86 deletions(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index 9cb60ce..09e5a6e 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2021/04/27 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/05/12 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -13,6 +13,7 @@ -- 2021/04/21 Anche feature lunga con due facce con opzione lama ora si taglia con lama. -- 2021/04/23 Corretto caso con antischeggia non inseriti perchè inutili. -- 2021/04/27 Antischeggia solo se feature trasversali. +-- 2021/05/12 Semplificata gestione diametro minimo utensile per svuotatura. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -2266,6 +2267,7 @@ local function MakeByChainOrSaw( Proc, nPhase, nRawId, nPartId, nFacInd, --else -- EgtSetMachiningParam( MCH_MP.FACEUSE, MCH_MILL_FU.PARAL_RIGHT) end + -- imposto angolo 3° asse rot EgtSetMachiningParam( MCH_MP.BLOCKEDAXIS, GetChainSawBlockedAxis( 1)) -- imposto offset radiale local dOffs = ( i - 1) * dStep @@ -2731,94 +2733,31 @@ local function SetOpenSide( nPathInt, vtOrtho, b3Solid, nAddGrpId, bStartPoint) end --------------------------------------------------------------------- -local function CheckPocketTool( sMchFind, dDiam, dElev) - - local sPocketing = ML.FindPocketing( sMchFind, dDiam, dElev) - if sPocketing then - -- recupero i dati dell'utensile - local dTDiam = 50 - if EgtMdbSetCurrMachining( sPocketing) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dTDiam - return true, dTDiam - end - end - return false -end - ---------------------------------------------------------------------- -local function CheckToolDiamByFaces( Proc, nFacInd, bFaceDown, dH, dV, bIsU, bIsL, dElev, nUseRoughTool) - local dMaxDimFace = max( dH, dV) - -- verifico che diametro utensile prende con la openpocket con la massima dimensione faccia - local bUseMaxTool, dMaxDiam - -- classe di lavorazione - local sMach = 'OpenPocket' .. EgtIf( bFaceDown, '_H2', '') - -- se è forzato l'uso del truciolatore non passo l'altezza di elevazione - if nUseRoughTool and nUseRoughTool == 1 then - bUseMaxTool, dMaxDiam = CheckPocketTool( sMach, dMaxDimFace) - else - bUseMaxTool, dMaxDiam = CheckPocketTool( sMach, dMaxDimFace, dElev) - end - -- se non trovato utensile esco - if not bUseMaxTool then - return false - end +local function GetUShapeWidth( Proc, nFacInd) -- Recupero le facce adiacenti alla principale local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] -- se non ho facce adiacenti esco subito - if not vAdj or #vAdj == 0 then - return false - end + if not vAdj or #vAdj == 0 then return nil end -- Normale della faccia local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, nFacInd, GDB_ID.ROOT) -- Cerco le facce adiacenti alla principale con angolo concavo >= 90 - local tWidth = {} - local tExtremPt = {} + local dWidth = 0 for i = 1, #vAdj do if vAdj[i] >= 0 then -- verifico l'angolo tra le facce ( esco se angolo compreso < 90) local bAdj, ptP1, ptP2, dAng = EgtSurfTmFacetsContact( Proc.Id, nFacInd, vAdj[i], GDB_ID.ROOT) - if bAdj and dAng < -90 - 20 * GEO.EPS_ANG_SMALL then - return false - end + if bAdj and dAng < -90 - 20 * GEO.EPS_ANG_SMALL then return nil end -- larghezza della faccia ortogonalmente alla adiacente local vtN2 = EgtSurfTmFacetNormVersor( Proc.Id, vAdj[i], 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 - table.insert( tWidth, b3Ref:getDimY()) - table.insert( tExtremPt, { ptP1, ptP2}) + dWidth = max( dWidth, b3Ref:getDimY()) end end end - -- se le facce di adiacenza non corrispondono con quelle della forma esco - if ( bIsU and #tWidth ~= 2) or ( bIsL and #tWidth ~= 1) then - return false - end - local dLargeVal = 0 - for i = 1, #tWidth do - dLargeVal = max( dLargeVal, tWidth[i]) - end - -- se facce U verifico se le distanze tra i punti sono minori delle distanze tra le facce - if bIsU then - local dLen11 = dist( tExtremPt[1][1], tExtremPt[2][1]) - local dLen12 = dist( tExtremPt[1][1], tExtremPt[2][2]) - local dLen21 = dist( tExtremPt[1][2], tExtremPt[2][1]) - local dLen22 = dist( tExtremPt[1][2], tExtremPt[2][2]) - dLargeVal = min( dLargeVal, dLen11, dLen12, dLen21, dLen22) - end - -- se forma a L, raggio inferiore alla dimensione minima e flag uso truciolatore, favorisco il suo utilizzo - if bIsL and nUseRoughTool == 1 and dMaxDiam / 2 < dLargeVal then - return dMaxDiam, 'OpenPocket', nUseRoughTool, dMaxDiam - else - -- per essere accettabile, il diametro massimo deve essere minore della larghezza della faccia - if dMaxDiam < dLargeVal + 20 * GEO.EPS_SMALL then - return dMaxDiam, 'OpenPocket', nUseRoughTool, dMaxDiam - else - return false, '', 0, dMaxDiam - end - end + return dWidth end --------------------------------------------------------------------- @@ -3484,11 +3423,17 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa local bMillDown = ( BD.DOWN_HEAD and vtN:getZ() < 0.342) -- settaggio voluto da Alessandro/Fabio (per fare angoli con fresa piccola) sMchFind = 'Pocket' - if ( Proc.Fct == 1) or ( Proc.Fct == 2 and bIsL) or ( Proc.Fct == 3 and bIsU) then sMchFind = 'OpenPocket' end + local dDiam = min( dH, dV) + if bSinglePart and (( Proc.Fct == 1) or ( Proc.Fct == 2 and bIsL) or ( Proc.Fct == 3 and bIsU)) then + sMchFind = 'OpenPocket' + if bIsU then + dDiam = GetUShapeWidth( Proc, nFacInd) or dDiam + else + dDiam = 300 + end + end sMchFindBackUp = sMchFind local nUseRoughTool = EgtIf( bSinglePart, 0, 1) - local dDiam = min( dH, dV) - local dDiamMax local nUseRT -- 04/08/2020 Se settato parametro uso truciolatore (parametro Q), non si devono prendere altre frese, si da errore (Fabio) -- Questa opzione si scontra facilmente con altre interpretazioni dello stasso parametro Q (per tornare indietro bNewCheck = false) @@ -3511,24 +3456,11 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa nUseRoughTool = 1 end end - -- verifico dalla forma se posso prendere utensile grande - --if ( Proc.Fct == 3 and bIsU and bSinglePart) or ( Proc.Fct == 2 and bIsL) or Proc.Fct == 1 then - -- sMchFindBackUp = sMchFind - -- --ottengo un diametro utensile opportuno - -- dDiam, sMchFind, nUseRoughTool, dDiamMax = CheckToolDiamByFaces( Proc, nFacInd, bMillDown, dH, dV, bIsU, bIsL, ( dFacElev + dCollSic), nUseRoughTool) - -- if not dDiam then - -- sMchFind = sMchFindBackUp - -- dDiam = min( dH, dV) - -- end - --end -- se processo 20 e non sto usando il truciolatore if Proc.Prc == 20 and nUseRoughTool == 0 then if nUseRT and nUseRT ~= 0 then sMchFind = 'OpenPocket' nUseRoughTool = 1 - if dDiamMax and Proc.Fct == 2 and bIsL then - dDiam = dDiamMax - end end end -- se da sotto, imposto massima lunghezza secondo la direzione