From b2f1645322b15603d052f99e3977032a8d4d26c2 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Fri, 2 Dec 2022 15:38:04 +0100 Subject: [PATCH] Improvement/SideMillGreater90: - aggiunto ripasso lato inclinato anche per svuotatura --- LuaLibs/WMachiningLib.lua | 2 +- LuaLibs/WProcessLapJoint.lua | 37 ++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/LuaLibs/WMachiningLib.lua b/LuaLibs/WMachiningLib.lua index ae106bc..e3b857c 100644 --- a/LuaLibs/WMachiningLib.lua +++ b/LuaLibs/WMachiningLib.lua @@ -56,7 +56,7 @@ function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, d local Milling = Millings[i] if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) - local sMyTuuid = EgtGetMachiningParam( MCH_MP.TUUID) + local sMyTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth()) local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) diff --git a/LuaLibs/WProcessLapJoint.lua b/LuaLibs/WProcessLapJoint.lua index 13d764b..35c8ef8 100644 --- a/LuaLibs/WProcessLapJoint.lua +++ b/LuaLibs/WProcessLapJoint.lua @@ -1945,9 +1945,10 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d -- imposto modo di lavorare la faccia EgtSetMachiningParam( MCH_MP.FACEUSE, nFace2ndFace) local dMaxElev = dMaxMat - local dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) - if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end + local dStepOtherFace = 0 if Proc.Fct == 2 and vtN2:getZ() < -0.99 and vtN2:getZ() > -1.01 then + dStepOtherFace = dStepOri or EgtGetMachiningParam( MCH_MP.STEP) + if dStepOtherFace < GEO.EPS_SMALL then dStepOtherFace = 0.75 * dMaxMat end local nStepOtherFace = ceil( ( dElevOtherFacet - dMaxMat) / dStepOtherFace) dStepOtherFace = max( ( dElevOtherFacet - dMaxMat) / max( nStepOtherFace, 1), 0) dMaxElev = max( ( nStepOtherFace + 1) * dStepOtherFace - GEO.EPS_SMALL, 0) @@ -2002,7 +2003,7 @@ local function MakeSideGrooveByMill( Proc, nFacet, nRawId, b3Raw, sCustomMach, d end end -- se richiesto, setto la nota per spostare la lavorazione alla fine - if not WD.SIDEMILL_BEFORE then + if bEnablePreMill or bAsEnablePreMill or not WD.SIDEMILL_BEFORE then EgtSetInfo( nMchFId, 'MOVE_AFTER', 1) end else @@ -2095,8 +2096,9 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) local dMillDiam = 20 local dMaxDepth = 0 local dThDiam = 100 + local sTuuid if EgtMdbSetCurrMachining( sPocketing) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth()) or dMaxDepth @@ -2163,7 +2165,7 @@ local function MakeByPocketing( Proc, nFacet, nRawId, b3Raw, bCheckQPar) else EgtErase( nNewProc) end - return true, sWarn + return true, sWarn, sTuuid end --------------------------------------------------------------------- @@ -2399,10 +2401,11 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) return MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, bLikeAsMakeFirstGroove) else local bOk, sErr = MakeByMill( Proc, nFacet, 1 - nFacet, nRawId, b3Raw, dSideDist) - if dAng and dAng > -90 + 10 * GEO.EPS_SMALL then + -- se angolo ottuso riprendo il lato quasi verticale + if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, EgtIf( bEnableMillOnSide and dMaxDepthOnSide, sMillOnSide, nil), dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) end - return bOk + return bOk, sErr end elseif bEnableMillOnSide and dMaxDepthOnSide > 0 then bLikeAsMakeFirstGroove = true @@ -2412,7 +2415,25 @@ local function MakeTwoFaces( Proc, nRawId, b3Raw) -- se non inclinate o capacità di taglio non sufficiente o non molto grandi (80mm), provo con contornatura o svuotatura if vtN:getZ() > 0.866 or vtNV:getZ() > 0.866 or not sCutting or dSawMaxDepth < dDimY[1] + WD.CUT_SIC or dSawMaxDepth < dDimY[2] + WD.CUT_SIC or dDimY[1] < 80 or dDimY[2] < 80 then -- eseguo la svuotatura - return MakeByPocketing( Proc, nFacet, nRawId, b3Raw) + local bOk, sErr, sTuuid = MakeByPocketing( Proc, nFacet, nRawId, b3Raw) + -- se angolo ottuso riprendo il lato quasi verticale + if bOk and dAng and dAng > -90 + 10 * GEO.EPS_SMALL then + local _, dHVert, dVVert = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacetVert, GDB_ID.ROOT) + local dDepth = min( dHVert, dVVert) + local _, dHHor, dVHor = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacet, GDB_ID.ROOT) + local dDiam = 2 * min( dHHor, dVHor) + local sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, sTuuid, nil, dDiam, nil, nil, nil) + if not sMillObtuseAngle then + sMillObtuseAngle = WM.FindMilling( 'FreeContour', dDepth, nil, nil, dDiam, nil, nil, nil) + end + if not sMillObtuseAngle then + local sErrMillNotFound = 'Error : Processing to finish obtuse angle not found in library' + EgtOutLog( sErrMillNotFound) + return true, sErrMillNotFound + end + local bOk2, sErr2 = MakeSideGrooveByMill( Proc, nFacetVert, nRawId, b3Raw, sMillObtuseAngle, dMaxDepthOnSide, bMakeFirstGroove, bMachFromDn, dAng, false, nil, true) + end + return bOk, sErr end -- se una delle due facce rivolta verso il basso elseif vtN[1]:getZ() < -0.001 or vtN[2]:getZ() < -0.001 then