From c6fbcbe08610d1872721fbfbc3e17d5e2da4a023 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sun, 15 Dec 2013 17:43:34 -0200 Subject: [PATCH] Arch: added alternative load mode for IFC files for benchmarking --- src/Mod/Arch/importIFC.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index cf54bba00..3f70867b3 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -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