Skip to content

Commit

Permalink
python: Path: *.py: Fix python3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
plaes authored and looooo committed Jan 29, 2017
1 parent 8ed62e3 commit 71f6a28
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/Mod/Path/PathScripts/TooltableEditor.py
Expand Up @@ -70,8 +70,8 @@ def startElement(self, tag, attributes):
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"])
Expand Down Expand Up @@ -122,8 +122,8 @@ def startElement(self, tag, attributes):
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"])
Expand Down Expand Up @@ -654,7 +654,7 @@ def delete(self):
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())
Expand Down Expand Up @@ -695,8 +695,8 @@ def write(self):
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:
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/centroid_post.py
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Path/PathScripts/example_pre.py
Expand Up @@ -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")
Expand Down Expand Up @@ -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.")

14 changes: 7 additions & 7 deletions src/Mod/Path/PathScripts/rml_post.py
Expand Up @@ -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']:
Expand Down Expand Up @@ -235,16 +235,16 @@ 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)
if not isinstance(code, list):
code = [ code ]
if len(code) and code[0]:
output += code
except NotImplementedError, e:
print e
except NotImplementedError as e:
print(e)

# footer
output += motoroff()
Expand All @@ -253,5 +253,5 @@ def parse(inputstring):

return '\n'.join(output)

print __name__ + " gcode postprocessor loaded."
print (__name__ + " gcode postprocessor loaded.")

6 changes: 3 additions & 3 deletions src/Mod/Path/PathScripts/slic3r_pre.py
Expand Up @@ -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")
Expand Down Expand Up @@ -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.")

0 comments on commit 71f6a28

Please sign in to comment.