Merge pull request #184 from sliptonic/master

Correctly format drilling locations.
This commit is contained in:
wwmayer 2016-06-04 14:01:51 +02:00
commit 82f610a198

View File

@ -27,6 +27,7 @@ import Path
import Part import Part
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
from PathScripts import PathUtils from PathScripts import PathUtils
from PathScripts.PathUtils import fmt
FreeCADGui = None FreeCADGui = None
if FreeCAD.GuiUp: if FreeCAD.GuiUp:
@ -127,7 +128,6 @@ class ObjectDrilling:
X = s.CenterOfMass.x X = s.CenterOfMass.x
Y = s.CenterOfMass.y Y = s.CenterOfMass.y
Z = s.CenterOfMass.z Z = s.CenterOfMass.z
locations.append(FreeCAD.Vector(X, Y, Z)) locations.append(FreeCAD.Vector(X, Y, Z))
@ -136,20 +136,20 @@ class ObjectDrilling:
output += "G0 Z" + str(obj.ClearanceHeight.Value) output += "G0 Z" + str(obj.ClearanceHeight.Value)
# rapid to first hole location, with spindle still retracted: # rapid to first hole location, with spindle still retracted:
p0 = locations[0] p0 = locations[0]
output += "G0 X" + str(p0.x) + " Y" + str(p0.y) + "\n" output += "G0 X" + fmt(p0.x) + " Y" + fmt(p0.y) + "\n"
# move tool to clearance plane # move tool to clearance plane
output += "G0 Z" + str(obj.ClearanceHeight.Value) + "\n" output += "G0 Z" + fmt(obj.ClearanceHeight.Value) + "\n"
if obj.PeckDepth.Value > 0: if obj.PeckDepth.Value > 0:
cmd = "G83" cmd = "G83"
qword = " Q" + str(obj.PeckDepth.Value) qword = " Q" + fmt(obj.PeckDepth.Value)
else: else:
cmd = "G81" cmd = "G81"
qword = "" qword = ""
for p in locations: for p in locations:
output += cmd + \ output += cmd + \
" X" + str(p.x) + \ " X" + fmt(p.x) + \
" Y" + str(p.y) + \ " Y" + fmt(p.y) + \
" Z" + str(obj.FinalDepth.Value) + qword + \ " Z" + fmt(obj.FinalDepth.Value) + qword + \
" R" + str(obj.RetractHeight.Value) + \ " R" + str(obj.RetractHeight.Value) + \
" F" + str(self.vertFeed) + "\n" \ " F" + str(self.vertFeed) + "\n" \