diff --git a/LuaLibs/BeamLib.lua b/LuaLibs/BeamLib.lua index ac1d639..c28d59f 100644 --- a/LuaLibs/BeamLib.lua +++ b/LuaLibs/BeamLib.lua @@ -1,4 +1,4 @@ --- BeamLib.lua by Egaltech s.r.l. 2021/06/27 +-- BeamLib.lua by Egaltech s.r.l. 2021/07/01 -- 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. @@ -11,6 +11,7 @@ -- 2021/03/22 Attacchi e uscite di tagli longitudinali da sotto con lama solo ortogonali. -- 2021/04/27 Migliorati controlli per attacchi e uscite Tg con lama. -- 2021/06/27 Aggiunta funzione GetOtherFaceElevation. +-- 2021/07/01 In GetNearestOrthoOpposite premio direzioni destra/sinistra. -- Tabella per definizione modulo local BeamLib = {} @@ -305,9 +306,10 @@ function BeamLib.GetNearestOrthoOpposite( vtRef, vtNorm) -- devo confrontare la componente orizzontale con quella verticale local dHorSq = vtMyRef:getX() * vtMyRef:getX() + vtMyRef:getY() * vtMyRef:getY() local dVertSq = vtMyRef:getZ() * vtMyRef:getZ() - -- se prevalente la componente orizzontale - if dHorSq >= dVertSq then - if abs( vtMyRef:getX()) > abs( vtMyRef:getY()) - GEO.EPS_SMALL then + -- se prevalente la componente orizzontale (con piccolo vantaggio) + if dHorSq >= 0.9 * dVertSq then + -- se prevale la componente destra/sinistra (con piccolo vantaggio) + if abs( vtMyRef:getX()) > 0.9 * abs( vtMyRef:getY()) then if vtMyRef:getX() > -GEO.EPS_SMALL then return MCH_MILL_FU.ORTHO_LEFT else diff --git a/LuaLibs/ProcessDoubleCut.lua b/LuaLibs/ProcessDoubleCut.lua index 87f5896..1d28741 100644 --- a/LuaLibs/ProcessDoubleCut.lua +++ b/LuaLibs/ProcessDoubleCut.lua @@ -1,4 +1,4 @@ --- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/02/28 +-- ProcessDoubleCut.lua by Egaltech s.r.l. 2021/07/01 -- Gestione calcolo doppi tagli di lama per Travi -- Tabella per definizione modulo @@ -266,11 +266,9 @@ 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 - local nOrthoOpposite = BL.GetNearestOrthoOpposite( vtOrthOpp, vtNorm) -- lavoro la faccia for j = 1, #vCuts[i] do - local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, nOrthoOpposite, EgtIf( bDownHead, -2, nil), 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) + local bOk, sErr = BL.MakeOneFaceBySaw( vCuts[i][j], 0, sCutting, dSawDiam, vtOrthOpp, EgtIf( bDownHead, -2, nil), 0, BD.CUT_SIC, 0, 0, 0, nil, b3Raw) if not bOk then return bOk, sErr end diff --git a/LuaLibs/ProcessLapJoint.lua b/LuaLibs/ProcessLapJoint.lua index c0018ac..6adecf6 100644 --- a/LuaLibs/ProcessLapJoint.lua +++ b/LuaLibs/ProcessLapJoint.lua @@ -1,4 +1,4 @@ --- ProcessLapJoint.lua by Egaltech s.r.l. 2021/06/21 +-- ProcessLapJoint.lua by Egaltech s.r.l. 2021/07/02 -- Gestione calcolo mezzo-legno per Travi -- 2019/10/08 Agg. gestione OpenPocket. -- 2021/01/24 Con sega a catena ora sempre impostato asse A. @@ -18,6 +18,7 @@ -- 2021/06/11 Su U passante e profonda se non bastano due svuotature su faccia ortogonale si fa anche la faccia di fondo per quanto possibile. -- 2021/06/21 Nel caso precedente si fa la terza svuotatura anche se è possibile fare una sola delle prime due (altra da sotto). -- 2021/06/21 Gestione ripresa spigoli o contorno con fresa più piccola ( diametro < 3/4 utensile svuotatura) attivata da parametro Q. +-- 2021/07/02 Migliorie e correzioni su svuotature e pulitura spigoli. -- Tabella per definizione modulo local ProcessLapJoint = {} @@ -260,15 +261,18 @@ local function VerifyChainSaw( Proc, dMinDim, dMaxDim, vtOrtho) end --------------------------------------------------------------------- -local function VerifyIfPocket( Proc, dDiam, dDepth, sMchFindMaster) +local function VerifyPocket( Proc, dDiam, dDepth, dMaxTotLen, sMchFindMaster) -- tipo di svuotatura local sMchFind = EgtIf( sMchFindMaster and #sMchFindMaster > 0, sMchFindMaster, 'Pocket') -- ricerca della svuotatura local sPocketing if dDepth then - sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth) or ML.FindPocketing( sMchFind, dDiam, 2/3 * dDepth) or ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, dDepth, dMaxTotLen) or + ML.FindPocketing( sMchFind, dDiam, 2/3 * dDepth, dMaxTotLen) or + ML.FindPocketing( sMchFind, dDiam, 1/2 * dDepth, dMaxTotLen) or + ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) else - sPocketing = ML.FindPocketing( sMchFind, dDiam) + sPocketing = ML.FindPocketing( sMchFind, dDiam, 0, dMaxTotLen) end if not sPocketing then return false @@ -289,7 +293,7 @@ local function VerifyIfPocket( Proc, dDiam, dDepth, sMchFindMaster) end --------------------------------------------------------------------- -local function VerifyIfByBHSideMill( Proc) +local function VerifyBHSideMill( Proc) local bUseBHSideMill = false local bHead = true local bHeadDir = true @@ -347,70 +351,54 @@ end --------------------------------------------------------------------- local function GetTunnelDimension( Proc, nPartId) - -- ottengo i versori delle 4 facce e ottengo l'orientamento del tunnel - -- recupero il numero di facce - local nFacCnt = EgtSurfTmFacetCount( Proc.Id) + -- sono necessarie almeno due facce + if Proc.Fct < 2 then return 0, 0, 0 end -- recupero l'ingombro della trave local b3Solid = EgtGetBBoxGlob( EgtGetFirstNameInGroup( nPartId, 'Box') or GDB_ID.NULL, GDB_BB.STANDARD) - -- variabili dimensioni fessura e id faccia lunga - local dDimMin - local dDimMax - local nLongIdFace = 0 - local bOppoFace = false - -- ottengo il versore ortogonale - local ptN1, vtN1 = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT) - local _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 1, GDB_ID.ROOT) - local vtOrtho = vtN1 ^ vtN2 - if vtOrtho:isSmall() then - _, vtN2 = EgtSurfTmFacetCenter( Proc.Id, 2, GDB_ID.ROOT) - vtOrtho = vtN1 ^ vtN2 - bOppoFace = true + -- recupero centro e normale delle facce + local ptC = {} + local vtN = {} + for i = 1, Proc.Fct do + ptC[i], vtN[i] = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) end - -- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta la profondità della fessura - local frFc = Frame3d( ptN1, vtOrtho) ; - local bBoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc) - local dDepth = bBoxLoc:getDimZ() + -- calcolo l'orientamento del tunnel + local vtOrtho = vtN[1] ^ vtN[2] + if vtOrtho:isSmall() then + if Proc.Fct >= 3 then + vtOrtho = vtN[1] ^ vtN[3] + else + return 0, 0, 0 + end + end + -- ottengo il boundingBox e prendo le dimensioni lungo la direzione (Z locale) che rappresenta la profondità della fessura + local frFc = Frame3d( ptC[1], vtOrtho) ; + local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc) + local dDepth = b3BoxLoc:getDimZ() -- recupero gruppo per geometria addizionale local nAddGrpId = BL.GetAddGroup( nPartId) if not nAddGrpId then - local sErr = 'Error : missing AddGroup' - EgtOutLog( sErr) - return false, sErr + EgtOutLog( 'Error : missing AddGroup') + return 0, 0, 0 end - -- mi assicuro che la Z del punto utilizzato per creare la superficie sia alla Z media del bounding box locale - local ptN2 = Point3d(ptN1) - ptN2:toLoc(frFc) - ptN2 = Point3d( ptN2:getX(), ptN2:getY(), ( bBoxLoc:getMin():getZ() + bBoxLoc:getMax():getZ())/2) - ptN2:toGlob(frFc) + -- centro del bounding box locale + local ptCen = b3BoxLoc:getCenter() + ptCen:toGlob( frFc) -- creo superficie intermedia - local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptN2, vtOrtho, b3Solid, GDB_ID.ROOT) + local nSurfInt = EgtSurfTmPlaneInBBox( nAddGrpId, ptCen, vtOrtho, b3Solid, GDB_ID.ROOT) + if not nSurfInt then return 0, 0, 0 end -- ritaglio la superficie con le facce della fessura - for i = 1, nFacCnt do - local ptN, vtN = EgtSurfTmFacetCenter( Proc.Id, i - 1, GDB_ID.ROOT) - EgtCutSurfTmPlane( nSurfInt, ptN, -vtN, false, GDB_ID.ROOT) + for i = 1, Proc.Fct do + EgtCutSurfTmPlane( nSurfInt, ptC[i], -vtN[i], false, GDB_ID.ROOT) end - local _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT) - dDimMin = min( DimH, DimV) - dDimMax = max( DimH, DimV) - _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacCnt-1, GDB_ID.ROOT) - -- se faccia pari alla larghezza fessura - if abs(DimH - dDimMax) < GEO.EPS_SMALL or abs(DimV - dDimMax) < GEO.EPS_SMALL then - nLongIdFace = nFacCnt-1 - -- altrimenti verifico anche con la faccia precedente - else - local nFaceToCheck = EgtIf( bOppoFace, nFacCnt-3, nFacCnt-2) - -- prendo le dimensioni della faccia e poi confronto con il minimo - _, DimH, DimV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFaceToCheck, GDB_ID.ROOT) - -- se trovato con il minimo, questa seconda faccia non è la più lunga - if abs(DimH - dDimMin) < GEO.EPS_SMALL or abs(DimV - dDimMin) < GEO.EPS_SMALL then - nLongIdFace = nFacCnt-1 - else - nLongIdFace = nFaceToCheck + local frSurfInt, dDimMax, dDimMin = EgtSurfTmFacetMinAreaRectangle( nSurfInt, 0, GDB_ID.ROOT) + -- cerco la faccia con larghezza pari a dimensione massima della fessura + local nLongIdFace = 0 + for i = 1, Proc.Fct do + if abs( vtN[i] * frSurfInt:getVersX()) < 0.5 then + nLongIdFace = i - 1 + break end end - if not dDimMax then - return dDimMin, dDimMax, dDepth, nil, nil - end return dDimMin, dDimMax, dDepth, vtOrtho, nLongIdFace, nSurfInt end @@ -523,7 +511,7 @@ function ProcessLapJoint.IsTailFeature( Proc, b3Raw) -- in base al tipo di feature attribuisco il significato dei parametri Q AssignQIdent( Proc) -- se può essere fatto con utensile tipo lama - local bUseBHSideMill, bHead, bHeadDir = VerifyIfByBHSideMill( Proc) + local bUseBHSideMill, bHead, bHeadDir = VerifyBHSideMill( Proc) if bUseBHSideMill then Proc.HeadDir = bHeadDir return not bHead @@ -647,9 +635,9 @@ function ProcessLapJoint.Classify( Proc, b3Raw) if bClosedOrthoFaces then -- ottengo le dimensioni del tunnel local dDimMin, dDimMax, dDepth, vtOrtho, nLundIdFace, nSurfInt = GetTunnelDimension( Proc, nPartId) - EgtErase(nSurfInt) + EgtErase( nSurfInt) -- verifico se può essere fatto con svuotatura - if VerifyIfPocket( Proc, dDimMin) then + if VerifyPocket( Proc, dDimMin) then return true, false elseif VerifyChainSaw( Proc, dDimMin, dDimMax, vtOrtho) then return true, false @@ -659,7 +647,7 @@ function ProcessLapJoint.Classify( Proc, b3Raw) else local rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) -- se può essere fatto con utensile tipo lama - local bUseBHSideMill, _, _, _, dMaxMat = VerifyIfByBHSideMill( Proc) + local bUseBHSideMill, _, _, _, dMaxMat = VerifyBHSideMill( Proc) if bUseBHSideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then return true, false -- altrimenti controllo se deve essere ruotato con le altre lavorazioni @@ -1149,6 +1137,16 @@ end local function ChooseBlindContour( Proc, nFacInd) -- Recupero le adiacenze della faccia principale local vAdj = EgtSurfTmFacetAdjacencies( Proc.Id, nFacInd)[1] + -- Verifico che ci siano facce adiacenti consecutive (sicuramente con angolo) + local bCorner = false + for i = 1, #vAdj do + local j = EgtIf( i > 1, i - 1, #vAdj) + if vAdj[i] >= 0 and vAdj[j] >= 0 then + bCorner = true + break + end + end + if not bCorner then return {} end -- Cerco le facce adiacenti con angolo convesso local tFacAdjMain = {} for i = 1, #vAdj do @@ -1568,7 +1566,6 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, local vtN1 local nFirstId, nNumId local dMaxElev - local dExtraDepth = 0 local dCollSic = 0 -- se non ho la faccia aggiunta @@ -1636,24 +1633,7 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, dCollSic = CalcCollisionSafety( vtOrtho) -- calcolo elevazione dalla faccia trasversale aggiunta local dSurfIntElev = BL.GetOtherFaceElevation( Proc.Id, nSurfInt, 0) - if bDoubleSide then - dMaxElev = dSurfIntElev - else - dMaxElev = dDepth - -- se la precedente svuotatura è stata fatta completamente in una sola volta - if bOneShot then - -- se non è possibile contornare completamente da una sola parte - if dTMaxDepth <= ( dMaxElev + BD.CUT_EXTRA + dCollSic) then - bDoubleSide = true - dMaxElev = dSurfIntElev - else - dExtraDepth = dMaxElev - dSurfIntElev - end - -- altrimenti non è stata fatta completamente calcolo la distanza tra faccia aggiunta e profondità superficie - else - dExtraDepth = dMaxElev - dSurfIntElev - end - end + dMaxElev = dSurfIntElev -- normale alla faccia aggiunta vtN1 = Vector3d( vtOrtho) -- imposto i lati aperti @@ -1725,10 +1705,10 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, end -- setto massimo affondamento possibile local dMachDepth = 0 - if ( dMaxElev + BD.CUT_EXTRA + dCollSic) > dTMaxDepth then - dMachDepth = dTMaxDepth - ( dMaxElev + BD.CUT_EXTRA) + if ( dMaxElev + dCollSic) > dTMaxDepth then + dMachDepth = dTMaxDepth - ( dMaxElev + dCollSic) end - EgtSetMachiningParam( MCH_MP.DEPTH, (dMachDepth+dExtraDepth)) + EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth) -- setto se devo invertire il percorso local bInvert = CheckToInvert( nIdPath, true) EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bInvertMach, not bInvert, bInvert)) @@ -1781,8 +1761,8 @@ local function MakeRoundCleanContour( Proc, nPhase, nRawId, nPartId, b3Raw, EgtSetMachiningParam( MCH_MP.ENDADDLEN, dTDiam * 0.75) -- setto massimo affondamento possibile local dMachDepth = 0 - if ( dMaxElev + BD.CUT_EXTRA + dCollSic) > dTMaxDepth then - dMachDepth = dTMaxDepth - ( dMaxElev + BD.CUT_EXTRA) + if ( dMaxElev + dCollSic) > dTMaxDepth then + dMachDepth = dTMaxDepth - ( dMaxElev + dCollSic) end EgtSetMachiningParam( MCH_MP.DEPTH, dMachDepth) -- setto se devo invertire il percorso @@ -2877,8 +2857,8 @@ local function MakeAntiSplintBySaw( Proc, nFacet, vtN, b3Raw, nFacInd, bReduceDe -- ottengo il boundingBox e prendo le dimensioni lungo la normale (Z locale) che rappresenta l'elevazione della faccia -- laterale sul punto medio della linea in comune local frFc = Frame3d( ptPm, vtN) ; - local bBoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc) - dDepth = bBoxLoc:getDimZ() or 0 + local b3BoxLoc = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frFc) + dDepth = b3BoxLoc:getDimZ() or 0 -- recupero i dati dell'utensile local dSawDiam = 400 local dSawThick = 0 @@ -3266,7 +3246,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha -- se smusso non è esclusivo if nChamfer < 2 then -- verifico se può essere fatto con svuotatura - local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyIfPocket( Proc, dDimMin, dDepth / 2, sMchFind) + local bMakePocket, sPocketing, dMaxDepth, dDiamTool = VerifyPocket( Proc, dDimMin, dDepth / 2, nil, sMchFind) if bMakePocket then -- gestione svuotatura da un solo lato o anche dal lato opposto (se non verticale) -- estraggo il contorno dalla superfice per evitare i problemi con la svuotatura @@ -3389,7 +3369,7 @@ local function MakeByPockets( Proc, nPhase, nRawId, nPartId, nChamfer, dDepthCha -- se anche lavorando dal lato opposto non riesco a svuotare completamente la fessura -- setto i parametri affondamento ed emetto warning if 2 * dMaxDepth < dDepth + 2 * BD.CUT_EXTRA + 2 * dCollSic then - dMachDepth = dMaxDepth - (dDepth / 2) + dMachDepth = dMaxDepth - ( dDepth / 2) - dCollSic dElev = dMaxDepth bComplete = false sWarn = 'Warning : elevation bigger than max tool depth' @@ -3875,7 +3855,7 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa -- verifico se due facce o L con una o due facce di terminazione local bIsL = ( Proc.Fct == 2 or TestElleShape3( Proc) or TestElleShape4( Proc) == 2) -- se fattibile con fresa BH di fianco e spessore utensile inferiore alla larghezza faccia - local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyIfByBHSideMill( Proc) + local bMakeBySideMill, bHead, bHeadDir, sMilling, dMaxMat, dToolDiam = VerifyBHSideMill( Proc) if bMakeBySideMill and ( dMaxMat <= dV + 15 * GEO.EPS_SMALL) then -- se smusso non è esclusivo if nChamfer < 2 then @@ -4106,8 +4086,10 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa return false, sErr end rfFac, dH, dV = EgtSurfTmFacetMinAreaRectangle( Proc.Id, nFacInd, GDB_ID.ROOT) - -- se forma a L e la componente in X è maggiore di 60° allora verifico se posso utilizzare la faccia secondaria - if bIsL and abs( vtN:getX()) > 0.866 then + -- se forma a L e la componente in X è maggiore di 60° e non in testa allora verifico se posso utilizzare la faccia secondaria + if bIsL and abs( vtN:getX()) > 0.866 and + ( Proc.Box:getMax():getX() < b3Solid:getMax():getX() - 10 or vtN:getX() < 0) and + ( not Proc.Tail or vtN:getX() > 0) then -- se non ho scambiato la faccia if not bUseOtherFace then if nFacInd2 then @@ -4194,18 +4176,24 @@ local function MakeMoreFaces( Proc, nPhase, nRawId, nPartId, dOvmHead, bSinglePa end -- ricerca lavorazione local sPocketing - local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen) - if not sMyPocketing then - sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen) - end + local _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind .. EgtIf( bMillDown, '_H2', '')) if not sMyPocketing and bMillUp then - sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic) - if not sMyPocketing then - sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam) - end + _, sMyPocketing, dMyTMaxDepth, dMyTDiam = VerifyPocket( Proc, dDiam, dFacElev + dCollSic, dMaxTotLen, sMchFind) bMillDown = false end - if sMyPocketing and ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic or ( bIsL and nUseRoughTool == 0)) then + --local sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, dFacElev + dCollSic, dMaxTotLen) + --if not sMyPocketing then + -- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind .. EgtIf( bMillDown, '_H2', ''), dDiam, nil, dMaxTotLen) + --end + --if not sMyPocketing and bMillUp then + -- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam, dFacElev + dCollSic) + -- if not sMyPocketing then + -- sMyPocketing, dMyTDiam, dMyTMaxDepth = ML.FindPocketing( sMchFind, dDiam) + -- end + -- bMillDown = false + --end + if sMyPocketing and + ( dMyTMaxDepth > dFacElev + dCollSic - 10 * GEO.EPS_SMALL or ( dMyTMaxDepth > 0.8 * dFacElev + dCollSic and not bIsU) or ( bIsL and nUseRoughTool == 0)) then sPocketing = sMyPocketing end if bMillDown then