Merge pull request #2966 from Schildkroet/master

[PATH] Added option to clear edges on PathMillFace
This commit is contained in:
sliptonic
2020-02-09 20:43:23 +01:00
committed by GitHub

View File

@@ -59,6 +59,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
'''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 @@ class ObjectFace(PathPocketBase.ObjectPocket):
'''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 @@ class ObjectFace(PathPocketBase.ObjectPocket):
# 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 @@ class ObjectFace(PathPocketBase.ObjectPocket):
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 @@ class ObjectFace(PathPocketBase.ObjectPocket):
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 @@ class ObjectFace(PathPocketBase.ObjectPocket):
def getAllIncludedFaces(self, base, env, faceZ):
included = []
eXMin = env.BoundBox.XMin
eXMax = env.BoundBox.XMax
eYMin = env.BoundBox.YMin
@@ -239,6 +254,7 @@ class ObjectFace(PathPocketBase.ObjectPocket):
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