diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index 1adc852..b1f32de 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,10 +1,11 @@ --- BeamLib.lua by Egaltech s.r.l. 2021/01/06 +-- BeamLib.lua by Egaltech s.r.l. 2021/02/03 -- Libreria globale per Travi -- 2020/07/28 Corretto calcolo attacchi e uscite di lame per non uscire dalla faccia sotto. -- 2020/08/18 Aggiunto a GetNearestParalOpposite e GetNearestOrthoOpposite parametro opzionale vtNorm. -- 2020/11/03 Aggiunta funzione IsEndOrEnd2Phase. -- 2020/11/18 Correzioni a GetParallelOpposite e a GetFaceElevation. -- 2021/01/06 Cambiato limite per attacco Tg con lama e CalcLeadInOutGeom rinominata in CalcLeadInOutPerpGeom. +-- 2021/02/03 In taglio lama si accettano anche due lati con deviazione minore di 20deg. -- Tabella per definizione modulo local BeamLib = {} @@ -824,21 +825,25 @@ function BeamLib.MakeOneFaceBySaw( nSurfId, nFacet, sCutting, dSawDiam, Par5, dV local vtTg = ptP2 - ptP1 ; vtTg:normalize() local dAllStart = 0 local dAllEnd = 0 - -- se bilinea, scarto la parte più allineata con la direzione ortogonale + -- se bilinea, scarto la parte più allineata con la direzione ortogonale (se deviazione angolare oltre 20 deg o lunghezza minore di dSawDiam/2 * cos( 20/2)) ma maggiore di un minimo if ( ( ptPm - ptP1) - ( ptPm - ptP1) * vtTg * vtTg):len() > 100 * GEO.EPS_SMALL then local vtTg1 = ptPm - ptP1 ; vtTg1:normalize() local vtTg2 = ptP2 - ptPm ; vtTg2:normalize() local dDist1 = dist( ptP1, ptPm) local dDist2 = dist( ptP2, ptPm) - --if dDist1 * ( vtTg1 ^ vtOrthO):len() > dDist2 * ( vtTg2 ^ vtOrthO):len() then - if abs( vtTg1 * vtOrthO) < abs( vtTg2 * vtOrthO) then - ptP2 = Point3d( ptPm) - dAllEnd = - dDist2 - 10 * GEO.EPS_SMALL - else - ptP1 = Point3d( ptPm) - dAllStart = - dDist1 - 10 * GEO.EPS_SMALL + local dCosMax = 0.939 + local dLenMin = 2 + local dLenMax = 0.5 * dSawDiam * 0.17365 + 1 + if vtTg1 * vtTg2 < dCosMax or ( dDist1 < dLenMax and dDist1 > dLenMin) or ( dDist2 < dLenMax and dDist2 > dLenMin) then + if abs( vtTg1 * vtOrthO) < abs( vtTg2 * vtOrthO) then + ptP2 = Point3d( ptPm) + dAllEnd = - dDist2 - 10 * GEO.EPS_SMALL + else + ptP1 = Point3d( ptPm) + dAllStart = - dDist1 - 10 * GEO.EPS_SMALL + end + vtTg = ptP2 - ptP1 ; vtTg:normalize() end - vtTg = ptP2 - ptP1 ; vtTg:normalize() end -- verifico se lavorazione con lama sotto e testa sopra if not dVzLimDwnUp then dVzLimDwnUp = -0.5 end diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index ec627fa..403c228 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -254,7 +254,7 @@ function ProcessDoubleCut.Make( Proc, nPhase, nRawId, nPartId, dOvmHead) local vtOrthOpp = vtN[nBigInd] local vtNorm = vtN[nSmaInd] if ( i % 2) ~= 1 then vtOrthOpp, vtNorm = vtNorm, vtOrthOpp end - if not bOnY then vtOrthOpp[2] = 0 end + --if not bOnY then vtOrthOpp[2] = 0 end local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtOrthOpp, vtNorm) -- lavoro la faccia for j = 1, #vCuts[i] do