Skip to content

Commit

Permalink
Bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic authored and yorikvanhavre committed Jul 12, 2016
1 parent 4880e63 commit c5b501b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/DragknifeDressup.py
Expand Up @@ -206,7 +206,7 @@ def arcTwist(self, obj, queue, lastXY, twistCW=False):

replace = Path.Command(
queue[0].Name, {"X": queue[0].X, "Y": queue[0].Y, "I": offsetv.x, "J": offsetv.y})
replace = None

return (results, replace)

def lineExtension(self, obj, queue):
Expand Down
27 changes: 15 additions & 12 deletions src/Mod/Path/PathScripts/PathEngrave.py
Expand Up @@ -110,9 +110,10 @@ def execute(self, obj):
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

if obj.Base:
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value)+"\n"

wires = []
for o in obj.Base:
output += "G0 " + str(obj.ClearanceHeight.Value)+"\n"
# we only consider the outer wire if this is a Face
for w in o[0].Shape.Wires:
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
Expand All @@ -121,9 +122,12 @@ def execute(self, obj):
if obj.Algorithm == "OCC Native":
output += self.buildpathocc(obj, wires)

output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value)+"\n"


# print output
if output == "":
output += "G0"
output += "(No commands processed)"

if obj.Active:
path = Path.Path(output)
Expand All @@ -140,8 +144,7 @@ def execute(self, obj):
def buildpathocc(self, obj, wires):
import Part
import DraftGeomUtils
output = "G90\nG21\nG40\n"
output += "G0 Z" + str(obj.ClearanceHeight.Value)
output = ""

# absolute coords, millimeters, cancel offsets

Expand All @@ -157,8 +160,8 @@ def buildpathocc(self, obj, wires):
if not last:
# we set the first move to our first point
last = edge.Vertexes[0].Point
output += "G0" + " X" + str("%f" % last.x) + " Y" + str("%f" % last.y) # Rapid sto starting position
output += "G1" + " X" + str("%f" % last.x) + " Y" + str("%f" % last.y) + " Z" + str("%f" % last.z) + "F " + str(self.vertFeed) + "\n" # Vertical feed to depth
output += "G0" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(obj.SafeHeight.Value) # Rapid sto starting position
output += "G1" + " X" + PathUtils.fmt(last.x) + " Y" + PathUtils.fmt(last.y) + " Z" + PathUtils.fmt(last.z) + "F " + PathUtils.fmt(self.vertFeed) + "\n" # Vertical feed to depth
if isinstance(edge.Curve, Part.Circle):
point = edge.Vertexes[-1].Point
if point == last: # edges can come flipped
Expand All @@ -171,20 +174,20 @@ def buildpathocc(self, obj, wires):
output += "G2"
else:
output += "G3"
output += " X" + str("%f" % point.x) + " Y" + str("%f" % point.y) + " Z" + str("%f" % point.z)
output += " I" + str("%f" % relcenter.x) + " J" + str("%f" % relcenter.y) + " K" + str("%f" % relcenter.z)
output += " F " + str(self.horizFeed)
output += " X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(point.z)
output += " I" + PathUtils.fmt(relcenter.x) + " J" + PathUtils.fmt(relcenter.y) + " K" + PathUtils.fmt(relcenter.z)
output += " F " + PathUtils.fmt(self.horizFeed)
output += "\n"
last = point
else:
point = edge.Vertexes[-1].Point
if point == last: # edges can come flipped
point = edge.Vertexes[0].Point
output += "G1 X" + str("%f" % point.x) + " Y" + str("%f" % point.y) + " Z" + str("%f" % point.z)
output += " F " + str(self.horizFeed)
output += "G1 X" + PathUtils.fmt(point.x) + " Y" + PathUtils.fmt(point.y) + " Z" + PathUtils.fmt(point.z)
output += " F " + PathUtils.fmt(self.horizFeed)
output += "\n"
last = point
output += "G0 Z " + str(obj.SafeHeight.Value)
output += "G0 Z " + PathUtils.fmt(obj.SafeHeight.Value)
return output

def addEngraveBase(self, obj, ss):
Expand Down

0 comments on commit c5b501b

Please sign in to comment.