From d221cec5bfa5112a849a3c0c762428a1499a7bef Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 21 Feb 2022 17:55:20 +0100 Subject: [PATCH] DataWall : - migliorata gestione tagli trasversali per macchine travi - corretti allungamenti/accorciamenti tagli inclinati con fresa. --- LuaLibs/WProcessFreeContour.lua | 42 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/LuaLibs/WProcessFreeContour.lua b/LuaLibs/WProcessFreeContour.lua index 6f388d6..df4be6a 100644 --- a/LuaLibs/WProcessFreeContour.lua +++ b/LuaLibs/WProcessFreeContour.lua @@ -1,9 +1,10 @@ --- ProcessFreeContour.lua by Egaltech s.r.l. 2022/02/03 +-- ProcessFreeContour.lua by Egaltech s.r.l. 2022/02/21 -- Gestione calcolo profilo libero per Pareti -- 2021/11/15 Penna e chiodature sono sempre riportate sulla faccia sopra anche se nel progetto sono sotto. -- 2021/12/10 In taglio con lama aggiunta gestione SCC per testa Gearbox. -- 2022/01/13 Aggiunta gestione massimo affondamento in Z anche per pulizia spigoli con fresa 60deg (WD.MAX_CLEAN_CRN60). -- 2022/02/03 Corretto controllo massimo affondamento nella tavola. +-- 2022/02/21 Per macchine travi migliorata gestione tagli trasversali. -- Tabella per definizione modulo local WPF = {} @@ -325,10 +326,17 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa -- recupero l'angolo con la faccia precedente local bAdj, ptLocP1, ptLocP2, dAng = EgtSurfTmFacetsContact( nNewProc, nPrecFac, nFac, GDB_ID.ROOT) local dPrevAng = EgtIf( bAdj, dAng, 0) + -- se angolo con faccia precedente negativo, calcolo anche angolo tra le facce nel piano + local dPlanePrevAng = 0 + if dPrevAng < 0 then + local vtPrevN = EgtSurfTmFacetNormVersor( nNewProc, nPrecFac, GDB_ID.ROOT) + local dCosA = ( Z_AX() ^ vtPrevN) * ( Z_AX() ^ vtN) + dPlanePrevAng = -acos( dCosA) + end -- calcolo l'angolo di inclinazione (dalla verticale) local dSideAng = asin( vtN:getZ()) -- salvo i dati - vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, PrevAng = dPrevAng, SideAng = dSideAng} + vFace[i] = { Fac = nFac, Cen = ptCen, Norm = vtN, Len = dLen, Width = dWidth, PrevAng = dPrevAng, PlPrevAng = dPlanePrevAng, SideAng = dSideAng} if bAdj then if ptLocP1:getZ() < ptLocP2:getZ() then vFace[i].PPrev = ptLocP1 @@ -354,12 +362,15 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa local dWhisk = EgtIf( bCalclForBlade, ( dElev * sqrt( dToolDiam / dElev - 1) + WHISK_SAFE) , (dToolDiam/2) + WHISK_SAFE) -- determino la lunghezza del taglio passante e il tipo di attacco e uscita local dLen = vFace[i].Len + local dLenY = dLen * abs( vFace[i].Norm:getX()) / sqrt( 1 - vFace[i].Norm:getZ() * vFace[i].Norm:getZ()) local nType = 0 - if vFace[i].PrevAng < -0.1 or ( WD.BEAM_MACHINE and not IsPointOnRawLongEdges( vFace[i].Cen, b3Raw) and dLen > 0.5 * WD.CUT_MAX_LENGTH) then + if vFace[i].PrevAng < -0.1 or + ( WD.BEAM_MACHINE and not IsPointOnRawLongEdges( vFace[i].Cen, b3Raw) and ( dLen > 0.5 * WD.CUT_MAX_LENGTH or dLenY > 0.9 * b3Raw:getDimY())) then dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0) nType = nType + 1 end - if vFace[EgtIf( i < nNumFacet, i + 1, 1)].PrevAng < -0.1 or ( WD.BEAM_MACHINE and not IsPointOnRawLongEdges( vFace[i].Cen, b3Raw) and dLen > 0.5 * WD.CUT_MAX_LENGTH) then + if vFace[EgtIf( i < nNumFacet, i + 1, 1)].PrevAng < -0.1 or + ( WD.BEAM_MACHINE and not IsPointOnRawLongEdges( vFace[i].Cen, b3Raw) and ( dLen > 0.5 * WD.CUT_MAX_LENGTH or dLenY > 0.9 * b3Raw:getDimY())) then dLen = dLen - EgtIf( bCalclForBlade, dWhisk, 0) nType = nType + 2 end @@ -456,7 +467,7 @@ local function GetFacesData( Proc, bOpposite, bCalclForBlade, dToolDiam, dToolMa for i = 1, #vFace do local Face = vFace[i] local sOut = 'Face '..tostring( Face.Fac)..' C'..tostring( Face.Cen)..' N'..tostring( Face.Norm).. - ' L='..EgtNumToString( Face.Len, 1)..' W='..EgtNumToString( Face.Width, 1)..' Ap='..EgtNumToString( Face.PrevAng, 1).. + ' L='..EgtNumToString( Face.Len, 1)..' W='..EgtNumToString( Face.Width, 1)..' Ap='..EgtNumToString( Face.PrevAng, 1)..' App='..EgtNumToString( Face.PlPrevAng, 1).. ' D='..EgtNumToString( Face.Depth, 1)..' B='..EgtNumToString( Face.Whisk, 1).. ' As='..EgtNumToString( Face.SideAng, 1)..' T='..tostring( Face.Type) EgtOutLog( sOut) end @@ -1215,9 +1226,16 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd if nConeCut == 1 then EgtSetMachiningParam( MCH_MP.LEAVETAB, false) end -- aggiungo geometria EgtSetMachiningGeometry( {{ Proc.Id, vFace[i].Fac}}) - local dSal = EgtIf( #vFace == 1 or vFace[i].PrevAng < -30, -dMillDiam / 2, 0) - if vFace[i].PrevAng < -30 and j and vFace[j].Norm:getZ() < -0.017 then - dSal = dSal + vFace[j].Width * vFace[j].Norm:getZ() + local dSal = 0 + if #vFace == 1 then dSal = -dMillDiam / 2 end + if vFace[i].PrevAng < -30 then + local dSinA = -sin( vFace[OrigI].PlPrevAng + 90) + local dTanA = -tan( vFace[OrigI].PlPrevAng + 90) + dSal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[OrigI].Width * vFace[OrigI].Norm:getZ() * dTanA) + -- se faccia precedente inclinata verso il basso + if vFace[i].PrevAng < -30 and j and vFace[j].Norm:getZ() < -0.017 then + dSal = dSal + vFace[j].Width * vFace[j].Norm:getZ() + end end local dEal = vFace[i].Whisk - vFace[i].Len EgtSetMachiningParam( MCH_MP.STARTADDLEN, dSal) @@ -1304,7 +1322,9 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd if vFace[OrigI].Type == 4 then -- se angolo interno prima if vFace[OrigI].PrevAng < -30 then - dSal = -dMillDiam / 2 + local dSinA = -sin( vFace[OrigI].PlPrevAng + 90) + local dTanA = -tan( vFace[OrigI].PlPrevAng + 90) + dSal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[OrigI].Width * vFace[OrigI].Norm:getZ() * dTanA) -- se faccia precedente inclinata verso il basso local OrigH = EgtIf( OrigI > 1, OrigI - 1, EgtIf( bClosed, #vFace, nil)) if OrigH and vFace[OrigH].Norm:getZ() < -0.017 then @@ -1318,7 +1338,9 @@ local function AddMillings( sMilling, vFace, Proc, nRawId, b3Raw, nConeCut, nAdd local OrigK = EgtIf( LastFace < #vFace, LastFace + 1, EgtIf( bClosed, 1, nil)) -- se angolo interno dopo if OrigK and vFace[OrigK].PrevAng < -30 then - dEal = -dMillDiam / 2 + local dSinA = -sin( vFace[OrigK].PlPrevAng + 90) + local dTanA = -sin( vFace[OrigK].PlPrevAng + 90) + dEal = -dMillDiam / 2 * ( 1 + ( 1 + dSinA) * dTanA) + min( 0, vFace[OrigI].Width * vFace[OrigI].Norm:getZ() * dTanA) -- se faccia successiva inclinata verso il basso if vFace[OrigK].Norm:getZ() < -0.017 then dEal = dEal + vFace[OrigK].Width * vFace[OrigK].Norm:getZ()