py3: fix some simple incompapilities

issue 0000995
This commit is contained in:
looooo
2017-06-21 11:25:30 +02:00
parent 931820c4b1
commit 3e8249a0e6
5 changed files with 14 additions and 14 deletions

View File

@@ -183,7 +183,7 @@ def export(exportList,filename,tessellation=1):
ver = FreeCAD.Version()
appli = "FreeCAD v" + ver[0] + "." + ver[1] + " build" + ver[2] + "\n"
cont.authoring_tool = appli
print author,appli
print(author, appli)
colmesh.assetInfo.contributors.append(cont)
colmesh.assetInfo.unitname = "meter"
colmesh.assetInfo.unitmeter = 1.0

View File

@@ -1012,8 +1012,8 @@ def p_circle_action(p) :
'circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL'
if printverbose: print("Circle : "+str(p[3]))
r = float(p[3]['r'])
# Avoid zero radius
if r == 0 : r = 0.00001
# Avoid zero radius
if r == 0 : r = 0.00001
n = int(p[3]['$fn'])
fnmax = FreeCAD.ParamGet(\
"User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
@@ -1146,19 +1146,19 @@ def p_polyhedron_action(p) :
v.append(FreeCAD.Vector(float(i[0]),float(i[1]),float(i[2])))
if printverbose:
print(v)
print ("Polyhedron "+p[9])
print ("Polyhedron "+p[9])
print (p[12])
faces_list = []
mypolyhed = doc.addObject('Part::Feature',p[1])
for i in p[12] :
if printverbose: print(i)
v2 = FreeCAD.Vector
pp =[v2(v[k]) for k in i]
# Add first point to end of list to close polygon
pp.append(pp[0])
print pp
w = Part.makePolygon(pp)
f = Part.Face(w)
v2 = FreeCAD.Vector
pp =[v2(v[k]) for k in i]
# Add first point to end of list to close polygon
pp.append(pp[0])
print(pp)
w = Part.makePolygon(pp)
f = Part.Face(w)
#f = make_face(v[int(i[0])],v[int(i[1])],v[int(i[2])])
faces_list.append(f)
shell=Part.makeShell(faces_list)

View File

@@ -156,7 +156,7 @@ class _CompoundFilter:
scale = obj.Base.Shape.BoundBox.DiagonalLength / math.sqrt(3) / math.sqrt(len(shps))
if scale < DistConfusion * 100:
scale = 1.0
print scale
print(scale)
obj.Shape = getNullShapeShape(scale)
raise ValueError('Nothing passes through the filter') # Feeding empty compounds to FreeCAD seems to cause rendering issues, otherwise it would have been a good idea to output nothing.

View File

@@ -146,7 +146,7 @@ def profile(curve, side_of_line, radius=1.0, vertfeed=0.0, horizfeed=0.0, offset
print("in profile: 151")
offset_curve = area.Curve(curve)
if offset_curve.getNumVertices() <= 1:
raise Exception, "Sketch has no elements!"
raise Exception("Sketch has no elements!")
if side_of_line == "On":
use_CRC = False

View File

@@ -324,7 +324,7 @@ def export(selection, filename, argstring):
gobjects = []
for g in selection[0].Group:
if g.Name <> 'Machine': # filtering out gcode home position from Machine object
if g.Name != 'Machine': # filtering out gcode home position from Machine object
gobjects.append(g)
for obj in gobjects: