python: Path: *.py: Fix python3 syntax

This commit is contained in:
Priit Laes 2016-03-12 14:59:57 +02:00 committed by looooo
parent 8ed62e3965
commit 71f6a289c6
5 changed files with 21 additions and 21 deletions

View File

@ -70,8 +70,8 @@ class FreeCADTooltableHandler(xml.sax.ContentHandler):
self.tool.Name = str(attributes["name"])
self.tool.ToolType = str(attributes["type"])
self.tool.Material = str(attributes["mat"])
# for some reason without the following line I get an error
print attributes["diameter"]
# for some reason without the following line I get an error
print(attributes["diameter"])
self.tool.Diameter = float(attributes["diameter"])
self.tool.LengthOffset = float(attributes["length"])
self.tool.FlatRadius = float(attributes["flat"])
@ -122,8 +122,8 @@ class HeeksTooltableHandler(xml.sax.ContentHandler):
self.tool.Material = "HighSpeedSteel"
elif m == "1":
self.tool.Material = "Carbide"
# for some reason without the following line I get an error
print attributes["diameter"]
# for some reason without the following line I get an error
print(attributes["diameter"])
self.tool.Diameter = float(attributes["diameter"])
self.tool.LengthOffset = float(attributes["tool_length_offset"])
self.tool.FlatRadius = float(attributes["flat_radius"])
@ -654,7 +654,7 @@ class Editor(QtGui.QDialog):
def addnew(self):
"adds a new tool at the end of the table"
tool = Path.Tool()
print self.NameField
print(self.NameField)
if self.NameField.text():
tool.Name = str(self.NameField.text())
tool.ToolType = self.getType(self.TypeField.currentIndex())
@ -695,8 +695,8 @@ class Editor(QtGui.QDialog):
fil.write('<?xml version="1.0" encoding="UTF-8"?>\n')
fil.write(self.tooltable.Content)
fil.close()
print "Written ", filename[0]
print("Written ",filename[0])
def moveup(self):
"moves a tool to a lower number, if possible"
if self.number:

View File

@ -73,7 +73,7 @@ def export(selection,filename,argstring):
params = ['X','Y','Z','A','B','I','J','F','H','S','T','Q','R','L'] #Using XY plane most of the time so skipping K
for obj in selection:
if not hasattr(obj,"Path"):
print "the object " + obj.Name + " is not a path. Please select only path and Compounds."
print("the object " + obj.Name + " is not a path. Please select only path and Compounds.")
return
myMachine = None
for pathobj in selection:

View File

@ -60,7 +60,7 @@ def insert(filename,docname):
def parse(inputstring):
"parse(inputstring): returns a parsed output string"
print "preprocessing..."
print("preprocessing...")
# split the input by line
lines = inputstring.split("\n")
@ -93,9 +93,9 @@ def parse(inputstring):
# no G or M command: we repeat the last one
output += lastcommand + " " + l + "\n"
print "done preprocessing."
print("done preprocessing.")
return output
print __name__ + " gcode preprocessor loaded."
print(__name__ + " gcode preprocessor loaded.")

View File

@ -135,15 +135,15 @@ def xyarc(args, state):
steps = 64 # TODO: specify max error instead
points = arc.discretize(steps)
# TODO: consider direction
#print 'p = Part.ArcOfCircle(Part.Circle(FreeCAD.Vector(%f, %f), FreeCAD.Vector(0, 0, 1), %f), %f, %f)' % (center.x, center.y, radius, p0, p1)
#print('p = Part.ArcOfCircle(Part.Circle(FreeCAD.Vector(%f, %f), FreeCAD.Vector(0, 0, 1), %f), %f, %f)' % (center.x, center.y, radius, p0, p1))
for p in points:
#print 'p', p.x, p.y
#print('p', p.x, p.y)
c += feed(p.x, p.y, state['Z'], state)
return c
def speed(xy=None, z=None, state={}):
c = []
print xy, z, state
print(xy, z, state)
if xy is not None:
xy = float(xy)
if xy > 0.0 and xy != state['XYspeed']:
@ -235,7 +235,7 @@ def parse(inputstring):
continue
parsed = PostUtils.stringsplit(line)
command = parsed['command']
print 'cmd', line
print('cmd', line)
try:
if command:
code = convertgcode(command, parsed, state)
@ -243,8 +243,8 @@ def parse(inputstring):
code = [ code ]
if len(code) and code[0]:
output += code
except NotImplementedError, e:
print e
except NotImplementedError as e:
print(e)
# footer
output += motoroff()
@ -253,5 +253,5 @@ def parse(inputstring):
return '\n'.join(output)
print __name__ + " gcode postprocessor loaded."
print (__name__ + " gcode postprocessor loaded.")

View File

@ -55,7 +55,7 @@ def insert(filename,docname):
def parse(inputstring):
"parse(inputstring): returns a parsed output string"
print "preprocessing..."
print("preprocessing...")
# split the input by line
lines = inputstring.split("\n")
@ -89,9 +89,9 @@ def parse(inputstring):
# no G or M command: we repeat the last one
output += lastcommand + " " + l + "\n"
print "done preprocessing."
print("done preprocessing.")
return output
print __name__ + " gcode preprocessor loaded."
print (__name__ + " gcode preprocessor loaded.")