diff --git a/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg b/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg
index 93099b9f55..114b07bc45 100644
--- a/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg
+++ b/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg
@@ -557,9 +557,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.8533932"
- inkscape:cx="-156.17498"
- inkscape:cy="193.24781"
+ inkscape:zoom="20.96875"
+ inkscape:cx="31.95231"
+ inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
@@ -595,7 +595,7 @@
image/svg+xml
-
+
Path-Drilling
2015-07-04
http://www.freecadweb.org/wiki/index.php?title=Artwork
@@ -625,19 +625,19 @@
inkscape:groupmode="layer">
+ transform="matrix(1.2383679,0,0,1,-39.034237,-12.932697)">
@@ -664,11 +664,11 @@
inkscape:connector-curvature="0"
id="rect4417-1-4-2-3"
d="m 24.826699,29.299103 0.02839,4.492034 14.320401,-6.092914 0.02324,-4.645526 z m 14.361546,4.789285 -14.374245,6.229006 0.01513,4.5902 14.389879,-6.224988 z m -0.01949,10.999765 -12.158366,5.23507 4.97403,3.277297 7.174659,-4.659288 z"
- style="color:#000000;fill:none;stroke:#d3d7cf;stroke-width:2.02702332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#d3d7cf;stroke-width:2.02702332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
diff --git a/src/Mod/Path/PathScripts/PathChamfer.py b/src/Mod/Path/PathScripts/PathChamfer.py
index f00d62d59a..500d05ee6c 100644
--- a/src/Mod/Path/PathScripts/PathChamfer.py
+++ b/src/Mod/Path/PathScripts/PathChamfer.py
@@ -46,35 +46,25 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
'''Proxy class for Chamfer operation.'''
def opFeatures(self, obj):
- return PathOp.FeatureTool | PathOp.FeatureDepths | PathOp.FeatureHeights | PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces;
+ return PathOp.FeatureTool | PathOp.FeatureHeights | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces
def initOperation(self, obj):
obj.addProperty("App::PropertyDistance", "Width", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The desired width of the chamfer"))
obj.addProperty("App::PropertyDistance", "ExtraDepth", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The additional depth of the tool path"))
- def opUpdateDepths(self, obj, ignoreErrors=False):
- angle = obj.ToolController.Tool.CuttingEdgeAngle
- if 0 == angle:
- angle = 180
- tan = math.tan(math.radians(angle/2))
- toolDepth = 0 if 0 == tan else obj.Width.Value / tan
- extraDepth = obj.ExtraDepth.Value
- depth = toolDepth + extraDepth
- obj.OpFinalDepth = depth
- if obj.OpStartDepth < obj.OpFinalDepth:
- obj.OpStartDepth = obj.OpFinalDepth + 1
-
def opExecute(self, obj):
angle = self.tool.CuttingEdgeAngle
if 0 == angle:
angle = 180
tan = math.tan(math.radians(angle/2))
+
+ toolDepth = 0 if 0 == tan else obj.Width.Value / tan
+ extraDepth = obj.ExtraDepth.Value
+ depth = toolDepth + extraDepth
toolOffset = self.tool.FlatRadius
extraOffset = self.tool.Diameter/2 - obj.Width.Value if 180 == angle else obj.ExtraDepth.Value / tan
offset = toolOffset + extraOffset
- zValues = self.getZValues(obj)
-
wires = []
for base, subs in obj.Base:
edges = []
@@ -93,7 +83,7 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
for w in self.adjustWirePlacement(obj, base, basewires):
wires.append(self.offsetWire(w, base, offset))
self.wires = wires
- self.buildpathocc(obj, wires, zValues)
+ self.buildpathocc(obj, wires, [depth], True)
def offsetWire(self, wire, base, offset):
def removeInsideEdges(edges):
diff --git a/src/Mod/Path/PathScripts/PathEngraveBase.py b/src/Mod/Path/PathScripts/PathEngraveBase.py
index 8b98d40547..ef11b9ec6d 100644
--- a/src/Mod/Path/PathScripts/PathEngraveBase.py
+++ b/src/Mod/Path/PathScripts/PathEngraveBase.py
@@ -29,6 +29,7 @@ import Path
import PathScripts.PathLog as PathLog
import PathScripts.PathOp as PathOp
import PathScripts.PathUtils as PathUtils
+import copy
from PathScripts.PathGeom import PathGeom
from PySide import QtCore
@@ -60,8 +61,8 @@ class ObjectOp(PathOp.ObjectOp):
self.zValues = zValues
return zValues
- def buildpathocc(self, obj, wires, zValues):
- '''buildpathocc(obj, wires, zValues) ... internal helper function to generate engraving commands.'''
+ def buildpathocc(self, obj, wires, zValues, rel=False):
+ '''buildpathocc(obj, wires, zValues, rel=False) ... internal helper function to generate engraving commands.'''
PathLog.track(obj.Label, len(wires), zValues)
for wire in wires:
@@ -71,54 +72,67 @@ class ObjectOp(PathOp.ObjectOp):
if hasattr(obj, 'StartVertex'):
offset = DraftGeomUtils.rebaseWire(offset, obj.StartVertex)
+ edges = copy.copy(offset.Edges)
last = None
+
for z in zValues:
if last:
- self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
+ if rel:
+ self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': last.z - z, 'F': self.vertFeed}))
+ else:
+ self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
- for edge in offset.Edges:
+ for edge in edges:
if not last:
# we set the first move to our first point
last = edge.Vertexes[0].Point
if len(offset.Edges) > 1:
+ ve = edge.Vertexes[-1]
e2 = offset.Edges[1]
- if not PathGeom.pointsCoincide(edge.Vertexes[-1].Point, e2.Vertexes[0].Point) and not PathGeom.pointsCoincide(edge.Vertexes[-1].Point, e2.Vertexes[-1].Point):
+ if not PathGeom.pointsCoincide(ve.Point, e2.Vertexes[0].Point) and not PathGeom.pointsCoincide(ve.Point, e2.Vertexes[-1].Point):
PathLog.debug("flip first edge")
last = edge.Vertexes[-1].Point
else:
PathLog.debug("original first edge")
else:
PathLog.debug("not enough edges to flip")
+
self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': obj.ClearanceHeight.Value, 'F': self.horizRapid}))
self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))
- self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
+ if rel:
+ self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': last.z - z, 'F': self.vertFeed}))
+ else:
+ self.commandlist.append(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': z, 'F': self.vertFeed}))
if PathGeom.pointsCoincide(last, edge.Vertexes[0].Point):
for cmd in PathGeom.cmdsForEdge(edge):
- params = cmd.Parameters
- params.update({'Z': z, 'F': self.horizFeed})
- self.commandlist.append(Path.Command(cmd.Name, params))
+ self.appendCommand(cmd, z, rel)
last = edge.Vertexes[-1].Point
else:
for cmd in PathGeom.cmdsForEdge(edge, True):
- params = cmd.Parameters
- params.update({'Z': z, 'F': self.horizFeed})
- self.commandlist.append(Path.Command(cmd.Name, params))
+ self.appendCommand(cmd, z, rel)
last = edge.Vertexes[0].Point
self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
if self.commandlist:
self.commandlist.pop()
+ def appendCommand(self, cmd, z, rel):
+ params = cmd.Parameters
+ if rel:
+ z = params['Z'] - z
+ params.update({'Z': z, 'F': self.horizFeed})
+ self.commandlist.append(Path.Command(cmd.Name, params))
def opSetDefaultValues(self, obj):
'''opSetDefaultValues(obj) ... set depths for engraving'''
- job = PathUtils.findParentJob(obj)
- if job and job.Base:
- bb = job.Base.Shape.BoundBox
- obj.OpStartDepth = bb.ZMax
- obj.OpFinalDepth = bb.ZMax - max(obj.StepDown.Value, 0.1)
- else:
- obj.OpFinalDepth = -0.1
+ if PathOp.FeatureDepths & self.opFeatures(obj):
+ job = PathUtils.findParentJob(obj)
+ if job and job.Base:
+ bb = job.Base.Shape.BoundBox
+ obj.OpStartDepth = bb.ZMax
+ obj.OpFinalDepth = bb.ZMax - max(obj.StepDown.Value, 0.1)
+ else:
+ obj.OpFinalDepth = -0.1
def adjustWirePlacement(self, obj, shape, wires):
job = PathUtils.findParentJob(obj)
diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py
index 5684dc5674..8dc9f1ebe6 100644
--- a/src/Mod/Path/PathScripts/PathOp.py
+++ b/src/Mod/Path/PathScripts/PathOp.py
@@ -132,6 +132,10 @@ class ObjectOp(object):
if FeatureNoFinalDepth & features:
obj.setEditorMode('FinalDepth', 2) # hide
self.addOpValues(obj, ['start', 'final'])
+ else:
+ # StartDepth has become necessary for expressions on other properties
+ obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Starting Depth internal use only for derived values"))
+ obj.setEditorMode('StartDepth', 1) # read-only
if FeatureStepDown & features:
obj.addProperty("App::PropertyDistance", "StepDown", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Incremental Step Down of Tool"))
@@ -258,6 +262,8 @@ class ObjectOp(object):
obj.OpFinalDepth = 0.0
else:
obj.FinalDepth = 0.0
+ else:
+ obj.StartDepth = 1.0
if FeatureStepDown & features:
if not self.applyExpression(obj, 'StepDown', job.SetupSheet.StepDownExpression):
@@ -355,6 +361,11 @@ class ObjectOp(object):
# update start depth if requested and required
if not PathGeom.isRoughly(obj.OpStartDepth.Value, zmax):
obj.OpStartDepth = zmax
+ else:
+ # every obj has a StartDepth
+ if obj.StartDepth.Value != zmax:
+ obj.StartDepth = zmax
+
self.opUpdateDepths(obj)
@waiting_effects