diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index 347d2fd4a267..cbb7e0d6243d 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -59,6 +59,7 @@ def initPocketOp(self, obj): '''initPocketOp(obj) ... create facing specific properties''' obj.addProperty("App::PropertyEnumeration", "BoundaryShape", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Shape to use for calculating Boundary")) obj.BoundaryShape = ['Perimeter', 'Boundbox', 'Stock'] + obj.addProperty("App::PropertyBool", "ClearEdges", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Clear edges")) if not hasattr(obj, 'ExcludeRaisedAreas'): obj.addProperty("App::PropertyBool", "ExcludeRaisedAreas", "Face", QtCore.QT_TRANSLATE_NOOP("App::Property", "Exclude milling raised areas inside the face.")) @@ -98,7 +99,7 @@ def areaOpShapes(self, obj): '''areaOpShapes(obj) ... return top face''' # Facing is done either against base objects holeShape = None - + if obj.Base: PathLog.debug("obj.Base: {}".format(obj.Base)) faces = [] @@ -146,6 +147,17 @@ def areaOpShapes(self, obj): # Find the correct shape depending on Boundary shape. PathLog.debug("Boundary Shape: {}".format(obj.BoundaryShape)) bb = planeshape.BoundBox + + # Apply offset for clearing edges + offset = 0; + if obj.ClearEdges == True: + offset = self.radius + 0.1 + + bb.XMin = bb.XMin - offset + bb.YMin = bb.YMin - offset + bb.XMax = bb.XMax + offset + bb.YMax = bb.YMax + offset + if obj.BoundaryShape == 'Boundbox': bbperim = Part.makeBox(bb.XLength, bb.YLength, 1, FreeCAD.Vector(bb.XMin, bb.YMin, bb.ZMin), FreeCAD.Vector(0, 0, 1)) env = PathUtils.getEnvelope(partshape=bbperim, depthparams=self.depthparams) @@ -158,6 +170,7 @@ def areaOpShapes(self, obj): elif obj.BoundaryShape == 'Stock': stock = PathUtils.findParentJob(obj).Stock.Shape env = stock + if obj.ExcludeRaisedAreas is True and oneBase[1] is True: includedFaces = self.getAllIncludedFaces(oneBase[0], stock, faceZ=minHeight) if len(includedFaces) > 0: @@ -181,6 +194,7 @@ def areaOpSetDefaultValues(self, obj, job): obj.StepOver = 50 obj.ZigZagAngle = 45.0 obj.ExcludeRaisedAreas = False + obj.ClearEdges = False # need to overwrite the default depth calculations for facing if job and len(job.Model.Group) > 0: @@ -209,6 +223,7 @@ def isPocket(self, b, f, w): def getAllIncludedFaces(self, base, env, faceZ): included = [] + eXMin = env.BoundBox.XMin eXMax = env.BoundBox.XMax eYMin = env.BoundBox.YMin @@ -239,6 +254,7 @@ def isOverlap(fMn, fMx, eMn, eMx): fYMax = face.BoundBox.YMax # fZMin = face.BoundBox.ZMin fZMax = face.BoundBox.ZMax + if fZMax > eZMin: if isOverlap(fXMin, fXMax, eXMin, eXMax) is True: if isOverlap(fYMin, fYMax, eYMin, eYMax) is True: @@ -252,6 +268,8 @@ def SetupProperties(): setup = PathPocketBase.SetupProperties() setup.append("BoundaryShape") setup.append("ExcludeRaisedAreas") + setup.append("ClearEdges") + return setup @@ -260,4 +278,5 @@ def Create(name, obj=None): if obj is None: obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) obj.Proxy = ObjectFace(obj, name) + return obj