From df1cb76993289240d87300a276bf97cd04dd7a41 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 5 Jun 2023 10:25:57 +0200 Subject: [PATCH 1/6] Check per deicidere se fare taglio standard o speciale --- LuaLibs/ProcessCut.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 51f2bd6..30290cc 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -395,6 +395,16 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b if bCustDiceCut and #vCuts == 0 then return false, -1 end + + -- per caso speciale in cui c'è il rischio che il cubetto rimanga appoggiato sul motore, faccio solo i tagli perpendicolari seguiti da due tagli verticali laterali + local bDangerousReliefCut = false + local frFace = BL.GetFaceHvRefDim( Proc.Id, 0) + -- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z + local vtTemp = EgtSurfTmFacetNormVersor( vCuts[1][1], 0, GDB_ID.ROOT) ^ frFace:getVersY() + if #vCuts > 0 and not ( bDownCut or bFromBottom) and bVertCutOk and vtTemp:isSmall() then + bDangerousReliefCut = true + end + --DC.PrintOrderCut( vCuts) if #vCuts > 0 then -- sistemo posizione nel DB e nome @@ -453,6 +463,12 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b end end end + + -- + if bDangerousReliefCut and i % 2 == 0 then + + end + -- lavoro la faccia for j = 1, #vCuts[i] do -- se taglio dal basso From dbbdd9f0df328a8c9eb1476080945b8d87a512ef Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 6 Jun 2023 11:13:54 +0200 Subject: [PATCH 2/6] funzionamento ok, da testare --- LuaLibs/ProcessCut.lua | 96 ++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 30290cc..3071633 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -401,7 +401,7 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b local frFace = BL.GetFaceHvRefDim( Proc.Id, 0) -- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z local vtTemp = EgtSurfTmFacetNormVersor( vCuts[1][1], 0, GDB_ID.ROOT) ^ frFace:getVersY() - if #vCuts > 0 and not ( bDownCut or bFromBottom) and bVertCutOk and vtTemp:isSmall() then + if #vCuts > 0 and vtTemp:isSmall() and not ( bDownCut or bFromBottom) then bDangerousReliefCut = true end @@ -464,49 +464,65 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b end end - -- - if bDangerousReliefCut and i % 2 == 0 then - + local bDoubleCutOk = false + local nSurfToCut + if i % 2 == 0 then + local _, dDiceFaceH = BL.GetFaceHvRefDim( vCuts[i][1], 0) + bDoubleCutOk = dDiceFaceH < 2 * ( dMaxDepth - BD.CUT_EXTRA) + nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false) end - - -- lavoro la faccia - for j = 1, #vCuts[i] do - -- se taglio dal basso - if bDownCut then - -- se strato pari composto da 1 o 2 elementi - if ( i % 2) == 0 and #vCuts[i] <= 2 then - -- il primo elemento prende la direzione prevista, il secondo quella opposta - local vtNewOrthoO = Vector3d( vtOrthoO) - local dVzLimDwnUp = dNzLimDwnUp - if j ~= 1 then - vtNewOrthoO = -vtOrthoO - if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 end + -- caso speciale con rischio cubetto sul motore + if bDangerousReliefCut and bDoubleCutOk then + local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT + if Proc.Tail then + nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1 + end + local dCutExtra = - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN + local bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true) + if not bOk then return false, sErr end + local bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw) + if not bOk2 then return false, sErr2 end + -- caso standard + else + -- lavoro la faccia + for j = 1, #vCuts[i] do + -- se taglio dal basso + if bDownCut then + -- se strato pari composto da 1 o 2 elementi + if ( i % 2) == 0 and #vCuts[i] <= 2 then + -- il primo elemento prende la direzione prevista, il secondo quella opposta + local vtNewOrthoO = Vector3d( vtOrthoO) + local dVzLimDwnUp = dNzLimDwnUp + if j ~= 1 then + vtNewOrthoO = -vtOrthoO + if not BD.C_SIMM and not BD.TURN and abs( vtN:getY()) > 0.05 then dVzLimDwnUp = -0.708 end + end + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + if not bOk then return bOk, sErr end end - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtNewOrthoO, dVzLimDwnUp, BD.CUT_EXTRA, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + -- tutti gli altri casi vengono saltati + -- caso generale + else + -- in generale sta sollevato di pochissimo + local dExtraCut = -0.1 + -- se tagli paralleli + if ( i % 2) == 0 then + -- se non ci sono tagli ortogonali devo affondare + if bNoPerpCuts then + dExtraCut = BD.CUT_EXTRA + -- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama + elseif bOrthInv then + dExtraCut = dSawThick + -- se ultimo taglio, devo affondare + elseif j == #vCuts[i] then + dExtraCut = BD.CUT_EXTRA + end + end + local dVzLimDwnUp = dNzLimDwnUp + if not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end + local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw) if not bOk then return bOk, sErr end end - -- tutti gli altri casi vengono saltati - -- caso generale - else - -- in generale sta sollevato di pochissimo - local dExtraCut = -0.1 - -- se tagli paralleli - if ( i % 2) == 0 then - -- se non ci sono tagli ortogonali devo affondare - if bNoPerpCuts then - dExtraCut = BD.CUT_EXTRA - -- se altrimenti tagli ortogonali invertiti, devo approfondire dello spessore lama - elseif bOrthInv then - dExtraCut = dSawThick - -- se ultimo taglio, devo affondare - elseif j == #vCuts[i] then - dExtraCut = BD.CUT_EXTRA - end - end - local dVzLimDwnUp = dNzLimDwnUp - if not BD.C_SIMM and not BD.TURN and vtN:getZ() > 0.707 then dVzLimDwnUp = -0.708 end - local bOk, sErr = Fbs.MakeOne( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthoO, dVzLimDwnUp, dExtraCut, BD.CUT_SIC, 0, 0, 0, sNotes, b3Raw) - if not bOk then return bOk, sErr end end end end From 0443133557570e52201178d71b8930db1d319265 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 14 Jun 2023 15:59:41 +0200 Subject: [PATCH 3/6] - lieve correzione per la lettura di vCuts --- LuaLibs/ProcessCut.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 3071633..96d54ba 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -400,9 +400,12 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b local bDangerousReliefCut = false local frFace = BL.GetFaceHvRefDim( Proc.Id, 0) -- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z - local vtTemp = EgtSurfTmFacetNormVersor( vCuts[1][1], 0, GDB_ID.ROOT) ^ frFace:getVersY() - if #vCuts > 0 and vtTemp:isSmall() and not ( bDownCut or bFromBottom) then - bDangerousReliefCut = true + local nFirstPerpendicularCut = ( #vCuts ~= 0 and ( vCuts[1][1] or vCuts[3][1])) + if nFirstPerpendicularCut then + local vtTemp = EgtSurfTmFacetNormVersor( nFirstPerpendicularCut, 0, GDB_ID.ROOT) ^ frFace:getVersY() + if #vCuts > 0 and vtTemp:isSmall() and not ( bDownCut or bFromBottom) then + bDangerousReliefCut = true + end end --DC.PrintOrderCut( vCuts) From 915f8973dbf3ae93f93507c453e47f0560fb4d88 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 16 Jun 2023 19:03:18 +0200 Subject: [PATCH 4/6] correzioni varie al funzionamento --- LuaLibs/ProcessCut.lua | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index 96d54ba..e69e809 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -466,23 +466,25 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b end end end - - local bDoubleCutOk = false - local nSurfToCut - if i % 2 == 0 then - local _, dDiceFaceH = BL.GetFaceHvRefDim( vCuts[i][1], 0) - bDoubleCutOk = dDiceFaceH < 2 * ( dMaxDepth - BD.CUT_EXTRA) - nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false) - end + local _, dDiceFaceH = BL.GetFaceHvRefDim( vCuts[i][1] or GDB_ID.NULL, 0) -- caso speciale con rischio cubetto sul motore - if bDangerousReliefCut and bDoubleCutOk then + if ( i % 2 == 0) and bDangerousReliefCut and ( dMaxDepth * 2 > dDiceFaceH + BD.CUT_EXTRA) then + local bDoubleCut = false + local nSurfToCut + local dCutExtra = BD.CUT_EXTRA + if dMaxDepth < dDiceFaceH + BD.CUT_EXTRA then + bDoubleCut = true + dCutExtra = - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA + end + nSurfToCut = EgtSurfTmBySewing( nAddGrpId, vCuts[i], false) local nFaceUseCut1, nFaceUseCut2 = MCH_MILL_FU.ORTHO_BACK, MCH_MILL_FU.ORTHO_FRONT if Proc.Tail then nFaceUseCut1, nFaceUseCut2 = nFaceUseCut2, nFaceUseCut1 end - local dCutExtra = - 0.5 * b3Raw:getDimY() + BD.CUT_EXTRA_MIN - local bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true) - if not bOk then return false, sErr end + if bDoubleCut then + local bOk, sErr = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut1, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw, true) + if not bOk then return false, sErr end + end local bOk2, sErr2 = Fbs.MakeOne( nSurfToCut, 0, sCutting, dSawDiam, nFaceUseCut2, nil, dCutExtra, BD.CUT_SIC, 0, 0, 0, '', b3Raw) if not bOk2 then return false, sErr2 end -- caso standard From c9cefa618ee3cf04b2065ef03a652c7b6bd963f6 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Mon, 19 Jun 2023 12:30:28 +0200 Subject: [PATCH 5/6] - modificato check direzione tagli perpendicolari per attivare o no i tagli speciali - esclusi i tagli speciali in caso di longcut --- LuaLibs/ProcessCut.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessCut.lua b/LuaLibs/ProcessCut.lua index e69e809..7033d40 100644 --- a/LuaLibs/ProcessCut.lua +++ b/LuaLibs/ProcessCut.lua @@ -18,6 +18,7 @@ -- 2022/08/30 Modificata la condizione che determina l'utilizzo della testa da sotto. Ora controlla se la trave è più grande del doppio della massima larghezza del cubetto. -- 2022/09/23 Corretta la condizione per cui è richiesto l'aggiornamento del grezzo. -- 2023/01/26 Migliorata la direzione di lavoro della lama in alcuni casi in cui il truciolo veniva scaricato dal lato errato. +-- 2023/06/19 Aggiunti tagli speciali per evitare il rischio che il cubetto rimanga appoggiato al motore. -- Tabella per definizione modulo local ProcessCut = {} @@ -402,8 +403,8 @@ local function MakeFromTop( sCutting, Proc, nPhase, nRawId, nPartId, dOvmHead, b -- verifico che i tagli perpendicolari siano perpendicolari al lato più vicino a Z local nFirstPerpendicularCut = ( #vCuts ~= 0 and ( vCuts[1][1] or vCuts[3][1])) if nFirstPerpendicularCut then - local vtTemp = EgtSurfTmFacetNormVersor( nFirstPerpendicularCut, 0, GDB_ID.ROOT) ^ frFace:getVersY() - if #vCuts > 0 and vtTemp:isSmall() and not ( bDownCut or bFromBottom) then + local vtTemp = EgtSurfTmFacetNormVersor( nFirstPerpendicularCut, 0, GDB_ID.ROOT) ^ frFace:getVersX() + if #vCuts > 0 and not ( vtTemp:isSmall()) and not ( bDownCut or bFromBottom) and not bLongCut then bDangerousReliefCut = true end end From 5004bc97b6bf64aa3c282ccccc3b1d8b1dd9025c Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Wed, 21 Jun 2023 11:11:09 +0200 Subject: [PATCH 6/6] In FreeContour aumentato l'angolo minimo che attiva l'attacco speciale --- LuaLibs/ProcessFreeContour.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index d56a7eb..69d0089 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -7,6 +7,7 @@ -- 2022/11/24 In MakeByMill aggiunta la lavorazione sopra/sotto nel caso di testa sotto -- In MakeByMill se BeamData forza lettura codolo da Q questo viene sempre fatto indipendentemente dalle dimensioni della feature -- 2023/03/03 Corretta MakeByMark ( non definiti b3Raw e b3Aux ). +-- 2023/06/21 In CalcSpecialAdd modificato l'angolo minimo da 5 a 15 deg. -- Tabella per definizione modulo local ProcessFreeContour = {} @@ -206,8 +207,8 @@ local function CalcSpecialAdd( nCrv, bStartVsEnd, dToolDiam) -- tangenti prima e dopo il punto interno local vtPrev = EgtUV( nCrv, nIn, -1) local vtNext = EgtUV( nCrv, nIn, 1) - -- se c'è perdita di tangenza (delta angolare oltre i 5 gradi) - if vtPrev * vtNext < 0.996 then + -- se c'è perdita di tangenza (delta angolare oltre i 15 gradi) + if vtPrev * vtNext < 0.966 then -- lunghezza del tratto local ptP0 = EgtUP( nCrv, nOut) local ptP1 = EgtUP( nCrv, nIn)