Path: Fix MillFace default values

fixes #3324
This commit is contained in:
sliptonic
2018-01-24 13:02:45 -06:00
committed by Yorik van Havre
parent 383825e9cf
commit 07ae0e56c4
3 changed files with 40 additions and 12 deletions

View File

@@ -49,6 +49,7 @@ else:
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
class ObjectFace(PathPocketBase.ObjectPocket):
'''Proxy object for Mill Facing operation.'''
@@ -67,12 +68,25 @@ class ObjectFace(PathPocketBase.ObjectPocket):
obj.StepOver = 1
# default depths calculation not correct for facing
if prop == "Base" and len(obj.Base) == 1:
base, sub = obj.Base[0]
shape = base.Shape.getElement(sub[0])
d = PathUtils.guessDepths(shape, None)
obj.OpStartDepth = d.safe_height
obj.OpFinalDepth = d.start_depth
if prop == "Base":
job = PathUtils.findParentJob(obj)
obj.OpStartDepth = job.Stock.Shape.BoundBox.ZMax
if len(obj.Base) >= 1:
print ('processing')
sublist = []
for i in obj.Base:
o = i[0]
for s in i[1]:
sublist.append(o.Shape.getElement(s))
# If the operation has a geometry identified the Finaldepth
# is the top of the bboundbox which includes all features.
# Otherwise, top of part.
obj.OpFinalDepth = Part.makeCompound(sublist).BoundBox.ZMax
else:
obj.OpFinalDepth = job.Base.Shape.BoundBox.ZMax
def areaOpShapes(self, obj):
'''areaOpShapes(obj) ... return top face'''
@@ -112,12 +126,18 @@ class ObjectFace(PathPocketBase.ObjectPocket):
obj.StepOver = 50
obj.ZigZagAngle = 45.0
# need to overwrite the default depth calculations for facing
job = PathUtils.findParentJob(obj)
# need to overwrite the default depth calculations for facing
if job and job.Base:
d = PathUtils.guessDepths(job.Base.Shape, None)
obj.OpStartDepth = d.safe_height
obj.OpFinalDepth = d.start_depth
obj.OpStartDepth = job.Stock.Shape.BoundBox.ZMax
obj.OpFinalDepth = job.Base.Shape.BoundBox.ZMax
# If the operation has a geometry identified the Finaldepth
# is the top of the bboundbox which includes all features.
if len(obj.Base) >= 1:
obj.OpFinalDepth = Part.makeCompound(obj.Base).BoundBox.ZMax
def Create(name):
'''Create(name) ... Creates and returns a Mill Facing operation.'''

View File

@@ -305,7 +305,7 @@ class ObjectOp(object):
def faceZmin(bb, fbb):
if fbb.ZMax == fbb.ZMin and fbb.ZMax == bb.ZMax: # top face
return bb.ZMin
return fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMax == bb.ZMax: # vertical face, full cut
return fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMin > bb.ZMin: # internal vertical wall
@@ -331,7 +331,9 @@ class ObjectOp(object):
zmax = max(zmax, fbb.ZMax)
else:
# clearing with stock boundaries
pass
job = PathUtils.findParentJob(obj)
zmax = stockBB.ZMax
zmin = job.Base.Shape.BoundBox.ZMax
if FeatureDepths & self.opFeatures(obj):
# first set update final depth, it's value is not negotiable

View File

@@ -101,6 +101,12 @@ class ObjectContour(PathProfileBase.ObjectProfile):
params['Coplanar'] = 2
return params
def updateDepths(self, obj, ignoreErrors=False):
stockBB = self.stock.Shape.BoundBox
obj.OpFinalDepth = stockBB.ZMin
obj.OpStartDepth = stockBB.ZMax
def Create(name):
'''Create(name) ... Creates and returns a Contour operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)