From 376f85d1f93ed61f6fbceb81d7011b9febfc37fb Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 31 Mar 2023 14:59:46 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20In=20LapJoint=20correzione=20al=20ca?= =?UTF-8?q?lcolo=20della=20distanza=20di=20collisione=20nel=20caso=20in=20?= =?UTF-8?q?cui=20il=20gambo=20sia=20pi=C3=B9=20piccolo=20dell'utensile.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaLibs/ProcessLapJoint.lua | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index cdd8172..d8b8b4c 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -64,6 +64,7 @@ -- 2023/02/06 Alla MakeDrillOnCorner aggiunto controllo distanza di sicurezza minima. -- 2023/02/16 Piccola correzione alla scelta utensile di svuotatura. -- 2023/02/21 Piccola correzione alla MakeByPocket. +-- 2023/03/31 Correzione al calcolo della distanza di collisione nel caso in cui il gambo sia più piccolo dell'utensile. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -5390,8 +5391,34 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- eseguo la svuotatura della faccia principale, mi restituisce id utensile, il diametro utensile per il foro opzionale local tvtNx = {} tvtNx[2] = vtN + -- recupero alcuni parametri dell'utensile per decidere la distanza di sicurezza da utilizzare + local dMaxToolCutDepth = 0 + local dMaxToolMaterial = 0 + local dToolThLength = 999 + local dToolTotalLength = 0 + local dToolThDiameter = 999 + local dToolDiameter = 0 + if EgtMdbSetCurrMachining( sPocketing) then + local sTuuidPk = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuidPk) or '') then + dMaxToolCutDepth = EgtTdbGetCurrToolMaxDepth() or dMaxToolCutDepth + dMaxToolMaterial = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxToolMaterial + dToolDiameter = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiameter + dToolThLength = EgtTdbGetCurrToolThLength() or dToolThLength + dToolThDiameter = EgtTdbGetCurrToolParam( MCH_TP.STEMDIAM) or dToolThDiameter + dToolTotalLength = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN) or dToolTotalLength + end + end + local dMachiningDepth = 0 + -- se il gambo è più largo dell'utensile verifico se la lunghezza del gambo è maggiore della distanza di sicurezza calcolata + local dShankLength = dToolTotalLength - dToolThLength - dMaxToolCutDepth + if ( dMaxToolCutDepth < dMaxToolMaterial + 10 * GEO.EPS_SMALL) and ( dShankLength > dCollSic + 10 * GEO.EPS_SMALL) then + dMachiningDepth = dFacElev + BD.COLL_SIC + else + dMachiningDepth = dFacElev + dCollSic + end local bOk, sWarn2 - bOk, sWarn2, sTuuidPk, dDiamTool = MakePocket( Proc, nPartId, b3Solid, 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, dMachiningDepth, nil, nil, bAllWithEndCap) if not bOk then return false, sWarn2 end if sWarn2 then if not sWarn then sWarn = '' end From f0c1c37bc5c6b4383d99725a3baa1acf5c8f8e2f Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 5 Apr 2023 17:10:19 +0200 Subject: [PATCH 2/2] correzione typo nome variabile --- LuaLibs/FacesBySaw.lua | 8 ++++---- LuaLibs/ProcessLongCut.lua | 8 ++++---- LuaLibs/ProcessLongDoubleCut.lua | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index 6d04a30..0536a5b 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -56,14 +56,14 @@ function FacesBySaw.MakeOne( nSurfId, nFacet, sCutting, dSawDiam, Par5, dVzLimDw -- verifico se lavorazione con lama sotto e testa sopra if not dVzLimDwnUp then dVzLimDwnUp = BL.GetNzLimDownUp( b3Raw, vtN, vtOrthO) end local bDownUp = ( vtN:getZ() < dVzLimDwnUp) - -- verifico se la lama ruota in senso orario + -- verifico se la lama ruota in senso antiorario if not EgtMdbSetCurrMachining( sCutting) then return false end - local bIsSawCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + local bIsSawCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 local bInvert = bForceInvert - -- se la lama ruota in senso orario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento - if bInvert == nil and bIsSawCW and not bDownUp then + -- se la lama ruota in senso antiorario inverto la direzione di lavorazione, per avere rotazione lama opposta a avanzamento + if bInvert == nil and bIsSawCCW and not bDownUp then if ( ptP2:getZ() > ptP1:getZ() + 100 * GEO.EPS_SMALL) then bInvert = false else diff --git a/LuaLibs/ProcessLongCut.lua b/LuaLibs/ProcessLongCut.lua index 2837fd1..3f79280 100644 --- a/LuaLibs/ProcessLongCut.lua +++ b/LuaLibs/ProcessLongCut.lua @@ -977,18 +977,18 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus end -- recupero alcune informazioni utili dalla lavorazione attuale - local bIsCurrentBladeCW + local bIsCurrentBladeCCW if bIsTopBladeCurrent then EgtMdbSetCurrMachining( sCutting) else EgtMdbSetCurrMachining( sCuttingDn) end - bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 -- imposto la direzione di lavoro per avere scarico del truciolo ottimale local nWorkSide, bInvert if not bIsTopBladeCurrent and abs( nSide) ~= 2 then - if bIsCurrentBladeCW then + if bIsCurrentBladeCCW then nWorkSide = MCH_MILL_WS.LEFT bInvert = true dSal, dEal = dEal, dSal @@ -997,7 +997,7 @@ function ProcessLongCut.Make( Proc, nPhase, nRawId, nPartId, bCustUseBlade, nCus bInvert = false end else - if bIsCurrentBladeCW then + if bIsCurrentBladeCCW then nWorkSide = MCH_MILL_WS.LEFT bInvert = false else diff --git a/LuaLibs/ProcessLongDoubleCut.lua b/LuaLibs/ProcessLongDoubleCut.lua index a1d3bc8..a433879 100644 --- a/LuaLibs/ProcessLongDoubleCut.lua +++ b/LuaLibs/ProcessLongDoubleCut.lua @@ -730,18 +730,18 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster end -- recupero alcune informazioni utili dalla lavorazione attuale - local bIsCurrentBladeCW + local bIsCurrentBladeCCW if bIsTopBladeCurrent then EgtMdbSetCurrMachining( sCutting) else EgtMdbSetCurrMachining( sCuttingDn) end - bIsCurrentBladeCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 + bIsCurrentBladeCCW = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) < 0 -- imposto la direzione di lavoro per avere scarico del truciolo ottimale local nWorkSide, bInvert if ( not bIsTopBladeCurrent and abs( nSide) ~= 0) or ( bCanUseBlade and bCanUseUnderBlade and nSide == -1) then - if bIsCurrentBladeCW then + if bIsCurrentBladeCCW then nWorkSide = MCH_MILL_WS.LEFT bInvert = true dSal, dEal = dEal, dSal @@ -750,7 +750,7 @@ function ProcessLong2Cut.Make( Proc, nPhase, nRawId, nPartId, bForcedBladeMaster bInvert = false end else - if bIsCurrentBladeCW then + if bIsCurrentBladeCCW then nWorkSide = MCH_MILL_WS.LEFT bInvert = false else