diff --git a/LuaLibs/ProcessFreeContour.lua b/LuaLibs/ProcessFreeContour.lua index 84d4c94..9650a7c 100644 --- a/LuaLibs/ProcessFreeContour.lua +++ b/LuaLibs/ProcessFreeContour.lua @@ -167,6 +167,23 @@ local function VerifyChamfer( Proc, AuxId, nRawId, bMakeVertCham) return nChamfer, dDepth, sMilling end +--------------------------------------------------------------------- +local function CalcCollisionSafety( vtDir) + local dCollSic = 10 * BD.COLL_SIC + if abs( vtDir:getX()) > 0.999 or abs( vtDir:getY()) > 0.999 or abs( vtDir:getZ()) > 0.999 then + dCollSic = 0 + elseif abs( vtDir:getX()) > 0.996 or abs( vtDir:getY()) > 0.996 or abs( vtDir:getZ()) > 0.996 then + dCollSic = 1 * BD.COLL_SIC + elseif abs( vtDir:getX()) > 0.89 or abs( vtDir:getY()) > 0.89 or abs( vtDir:getZ()) > 0.89 then + dCollSic = 2.5 * BD.COLL_SIC + elseif abs( vtDir:getX()) > 0.866 or abs( vtDir:getY()) > 0.866 or abs( vtDir:getZ()) > 0.866 then + dCollSic = 4 * BD.COLL_SIC + elseif abs( vtDir:getX()) > 0.707 or abs( vtDir:getY()) > 0.707 or abs( vtDir:getZ()) > 0.707 then + dCollSic = 5.5 * BD.COLL_SIC + end + return dCollSic +end + --------------------------------------------------------------------- local function CalcSpecialAdd( nCrv, bStartVsEnd, dToolDiam) -- recupero il dominio della curva @@ -239,6 +256,8 @@ local function MakeByMill( Proc, nPhase, nRawId, nPartId, dOvmHead) dMaxDepth = EgtTdbGetCurrToolMaxDepth() or dMaxDepth end end + local dCollSic = CalcCollisionSafety( vtExtr) + dMaxDepth = dMaxDepth - dCollSic -- ne verifico la lunghezza per eventuale spezzatura e lavorazione in doppio local nStep = 1 local dStep = 0