diff --git a/LuaLibs/WProcessDrill.lua b/LuaLibs/WProcessDrill.lua index 29d00fe..b9fecc7 100644 --- a/LuaLibs/WProcessDrill.lua +++ b/LuaLibs/WProcessDrill.lua @@ -258,40 +258,44 @@ function WPD.Make( Proc, nRawId, b3Raw) if Proc.Fcs == 0 then bToInvert = true end -- se richiesta inversione, inverto versore di riferimento if bToInvert then vtExtr = - vtExtr end - -- recupero eventuale flag per fare sola contornatura - local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0) - -- recupero la lavorazione (foratura/svuotatura oppure contornatura) - local sDrilling, nType + -- recupero la lavorazione (foratura/svuotatura) local sHead - if nContourOnly ~= 1 then - if WD.HOR_DRILL_Y_SPLIT and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then - local dExtrY = vtExtr:getY() - if not bOpen or abs( Proc.Flg) == 2 then - sHead = EgtIf( dExtrY > 0, 'H5', 'H6') + if WD.HOR_DRILL_Y_SPLIT and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then + local dExtrY = vtExtr:getY() + if not bOpen or abs( Proc.Flg) == 2 then + sHead = EgtIf( dExtrY > 0, 'H5', 'H6') + else + if Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then + sHead = 'H5' + if vtExtr:getY() < 0 then bToInvert = true end else - if Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then - sHead = 'H5' - if vtExtr:getY() < 0 then bToInvert = true end - else - sHead = 'H6' - if vtExtr:getY() > 0 then bToInvert = true end - end + sHead = 'H6' + if vtExtr:getY() > 0 then bToInvert = true end end end - sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead) + end + local sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead) + if not sDrilling then + sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead) + end + if sHead and not sDrilling then + sDrilling, nType = WM.FindDrilling( dDiam, dLen) if not sDrilling then - sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead) + sDrilling, nType = WM.FindDrilling( dDiam) end - if sHead and not sDrilling then - sDrilling, nType = WM.FindDrilling( dDiam, dLen) - if not sDrilling then - sDrilling, nType = WM.FindDrilling( dDiam) + if sDrilling then sHead = '' end + end + -- se trovata svuotatura, verifico se richiesta invece contornatura + if nType == 'Pocket' then + -- recupero eventuale flag per fare sola contornatura + local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0) + if nContourOnly == 1 then + sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true) + if sDrilling then + nType = 'Mill' + sHead = '' end - if sDrilling then sHead = '' end end - else - sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true) - nType = 'Mill' end if not sDrilling then local sErr = 'Error : drilling not found in library'