Arch: added alternative load mode for IFC files for benchmarking

This commit is contained in:
Yorik van Havre 2013-12-15 17:43:34 -02:00
parent 45c4c695a1
commit c6fbcbe086

View File

@ -31,6 +31,7 @@ __url__ = "http://www.freecadweb.org"
# config
subtractiveTypes = ["IfcOpeningElement"] # elements that must be subtracted from their parents
SCHEMA = "http://www.steptools.com/support/stdev_docs/express/ifc2x3/ifc2x3_tc1.exp"
MAKETEMPFILES = False # if True, shapes are passed from ifcopenshell to freecad through temp files
# end config
if open.__module__ == '__builtin__':
@ -526,8 +527,17 @@ def getShape(obj):
import Part
sh=Part.Shape()
try:
sh.importBrepFromString(obj.mesh.brep_data)
#sh = Part.makeBox(2,2,2)
if MAKETEMPFILES:
import tempfile
tf = tempfile.mkstemp(suffix=".brp")[1]
of = pyopen(tf,"wb")
of.write(obj.mesh.brep_data)
of.close()
sh = Part.read(tf)
os.remove(tf)
else:
sh.importBrepFromString(obj.mesh.brep_data)
#sh = Part.makeBox(2,2,2)
except:
print "Error: malformed shape"
return None