From ea9db1631bdbf1581fce017d582bbdd942e6b443 Mon Sep 17 00:00:00 2001 From: "luca.mazzoleni" Date: Tue, 18 Jun 2024 12:47:51 +0200 Subject: [PATCH] in FacesBySaw -> MakeTwo si accettano facce con qualunque orientazione a patto che siano in testa o in coda e abbastanza piccole --- LuaLibs/FacesBySaw.lua | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/LuaLibs/FacesBySaw.lua b/LuaLibs/FacesBySaw.lua index ebf2f8e..d16b546 100644 --- a/LuaLibs/FacesBySaw.lua +++ b/LuaLibs/FacesBySaw.lua @@ -514,6 +514,25 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, EgtOutLog( sErr) return false, sErr end + -- recupero la lavorazione + local sCutting = ML.FindCutting( sCutType, nil, bDownHead) + if not sCutting then + local sErr = 'Error : cutting not found in library' + EgtOutLog( sErr) + return false, sErr + end + -- recupero i dati dell'utensile + local dSawDiam = 400 + local dSawThick = 5 + local dMaxDepth = 0 + if EgtMdbSetCurrMachining( sCutting) then + local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) + if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then + dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam + dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick + dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth + end + end -- dati delle facce local ptC = {} local vtN = {} @@ -529,10 +548,10 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, local ptM = ( ptT1 + ptT2) / 2 local vtTg = ptT2 - ptT1 ; vtTg:normalize() local bConvex = ( dAngT > 0) - -- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg) + -- verifico non siano orientate troppo verso il basso e molto sbandate (oltre 10 deg), oppure in testa o in coda e non troppo distanti dal grezzo esterno local bFaceOk = {} - bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174) - bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174) + bFaceOk[1] = ( vtN[1]:getZ() >= BD.NZ_MINB or abs( vtN[1]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[1].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL)) + bFaceOk[2] = ( vtN[2]:getZ() >= BD.NZ_MINB or abs( vtN[2]:getY()) < 0.174 or ( Proc.AffectedFaces.Left ~= Proc.AffectedFaces.Right and Proc.Face[2].Elevation < dMaxDepth - 10 * GEO.EPS_SMALL)) if not bDownHead and ( not bFaceOk[1] or not bFaceOk[2]) then local sErr = 'Error : TwoFacesBySaw from bottom impossible' EgtOutLog( sErr) @@ -567,25 +586,6 @@ function FacesBySaw.MakeTwo( Proc, nPhase, nRawId, nPartId, dOvmHead, sCutType, nUpInd = nBigInd nOtInd = nSmaInd end - -- recupero la lavorazione - local sCutting = ML.FindCutting( sCutType, nil, bDownHead) - if not sCutting then - local sErr = 'Error : cutting not found in library' - EgtOutLog( sErr) - return false, sErr - end - -- recupero i dati dell'utensile - local dSawDiam = 400 - local dSawThick = 5 - local dMaxDepth = 0 - if EgtMdbSetCurrMachining( sCutting) then - local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID) - if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then - dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dSawDiam - dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or dSawThick - dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth - end - end -- calcolo extra taglio local dCutExtra = 0 if dAngT < -91 and dAngT > -179 then