py3: open function is in module 'io' in py3 instead of __builtin__
This commit is contained in:
parent
4f43cfac50
commit
8ad2c699f8
|
@ -633,7 +633,7 @@ class Component:
|
|||
except Part.OCCError:
|
||||
# error in computing the areas. Better set them to zero than show a wrong value
|
||||
if obj.HorizontalArea.Value != 0:
|
||||
print "Debug: Error computing areas for ",obj.Label,": unable to project face: ",str([v.Point for v in f.Vertexes])," (face normal:",f.normalAt(0,0),")"
|
||||
print("Debug: Error computing areas for ",obj.Label,": unable to project face: ",str([v.Point for v in f.Vertexes])," (face normal:",f.normalAt(0,0),")")
|
||||
obj.HorizontalArea = 0
|
||||
if hasattr(obj,"PerimeterLength"):
|
||||
if obj.PerimeterLength.Value != 0:
|
||||
|
|
|
@ -647,10 +647,10 @@ class _Roof(ArchComponent.Component):
|
|||
rn += 1
|
||||
if obj.RidgeLength.Value != rl:
|
||||
obj.RidgeLength = rl
|
||||
print str(rn)+" ridge edges in roof "+obj.Name
|
||||
print(str(rn)+" ridge edges in roof "+obj.Name)
|
||||
if obj.BorderLength.Value != bl:
|
||||
obj.BorderLength = bl
|
||||
print str(bn)+" border edges in roof "+obj.Name
|
||||
print(str(bn)+" border edges in roof "+obj.Name)
|
||||
ArchComponent.Component.computeAreas(self,obj)
|
||||
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ class _ArchSchedule:
|
|||
obj.Result.set("A"+str(i+2),obj.Description[i].encode("utf8"))
|
||||
if verbose:
|
||||
l= "OPERATION: "+obj.Description[i]
|
||||
print l
|
||||
print len(l)*"="
|
||||
print (l)
|
||||
print (len(l)*"=")
|
||||
# get list of objects
|
||||
objs = obj.Objects[i]
|
||||
val = obj.Value[i]
|
||||
|
@ -172,7 +172,7 @@ class _ArchSchedule:
|
|||
if val.upper() == "COUNT":
|
||||
val = len(objs)
|
||||
if verbose:
|
||||
print val, ",".join([o.Label for o in objs])
|
||||
print (val, ",".join([o.Label for o in objs]))
|
||||
obj.Result.set("B"+str(i+2),str(val))
|
||||
else:
|
||||
vals = val.split(".")
|
||||
|
@ -180,13 +180,13 @@ class _ArchSchedule:
|
|||
for o in objs:
|
||||
if verbose:
|
||||
l = o.Name+" ("+o.Label+"):"
|
||||
print l+(40-len(l))*" ",
|
||||
print (l+(40-len(l))*" ",)
|
||||
try:
|
||||
d = o
|
||||
for v in vals[1:]:
|
||||
d = getattr(d,v)
|
||||
if verbose:
|
||||
print d
|
||||
print (d)
|
||||
if hasattr(d,"Value"):
|
||||
d = d.Value
|
||||
except:
|
||||
|
@ -216,7 +216,7 @@ class _ArchSchedule:
|
|||
else:
|
||||
obj.Result.set("B"+str(i+2),str(val))
|
||||
if verbose:
|
||||
print "TOTAL:"+34*" "+str(val)
|
||||
print ("TOTAL:"+34*" "+str(val))
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
|
|
@ -35,7 +35,7 @@ import os,time,tempfile,uuid,FreeCAD,Part,Draft,Arch,math,DraftVecUtils
|
|||
|
||||
DEBUG = False
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pyopen = open # because we'll redefine open below
|
||||
|
||||
# which IFC type must create which FreeCAD type
|
||||
|
|
|
@ -56,7 +56,7 @@ supportedIfcTypes = ["IfcSite", "IfcBuilding", "IfcBuildingStorey", "IfcBeam", "
|
|||
"IfcPile", "IfcFooting", "IfcReinforcingBar", "IfcTendon"]
|
||||
# TODO : shading device not supported?
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pyopen = open # because we'll redefine open below
|
||||
|
||||
def open(filename,skip=None):
|
||||
|
|
|
@ -40,7 +40,7 @@ else:
|
|||
|
||||
p = Draft.precision()
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
def findVert(aVertex,aList):
|
||||
|
|
|
@ -34,7 +34,7 @@ import os,zipfile,xml.sax,FreeCAD,Part,Draft,Arch,Mesh,tempfile,math,Sketcher
|
|||
|
||||
DEBUG = True
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pyopen = open # because we'll redefine open below
|
||||
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ template = """<!DOCTYPE html>
|
|||
</html>"""
|
||||
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
def export(exportList,filename):
|
||||
|
|
|
@ -34,7 +34,7 @@ import re, FreeCAD, FreeCADGui, Part, cProfile, os, string
|
|||
from FreeCAD import Vector, Base
|
||||
from Draft import makeWire
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
useDraftWire = True
|
||||
|
|
|
@ -65,7 +65,7 @@ dxfReader = None
|
|||
dxfColorMap = None
|
||||
dxfLibrary = None
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open # to distinguish python built-in open function from the one declared here
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ try: import FreeCADGui
|
|||
except ValueError: gui = False
|
||||
else: gui = True
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
||||
|
|
|
@ -55,7 +55,7 @@ else: gui = True
|
|||
try: draftui = FreeCADGui.draftToolBar
|
||||
except AttributeError: draftui = None
|
||||
|
||||
if open.__module__ == '__builtin__':
|
||||
if open.__module__ in ['__builtin__','io']:
|
||||
pythonopen = open
|
||||
|
||||
svgcolors = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user