From bf19e80de17454b170cde98df5e4995a7a4991f6 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 7 Jan 2016 15:27:49 -0200 Subject: [PATCH] Arch: fixed encoding bugs --- src/Mod/Arch/importIFC.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index e49c622e1..d3e1b1f7e 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -27,6 +27,8 @@ __url__ = "http://www.freecadweb.org" import os,time,tempfile,uuid,FreeCAD,Part,Draft,Arch,math,DraftVecUtils +DEBUG = False + if open.__module__ == '__builtin__': pyopen = open # because we'll redefine open below @@ -913,16 +915,16 @@ def export(exportList,filename): if hasattr(obj,"Additions") and (shapetype == "extrusion"): for o in obj.Additions: r2,p2,c2 = getRepresentation(ifcfile,context,o,forcebrep=True) - if DEBUG: print " adding ",c2," : ",str(o.Label) - prod2 = ifcfile.createIfcBuildingElementProxy(ifcopenshell.guid.compress(uuid.uuid1().hex),history,str(o.Label),None,None,p2,r2,None,"ELEMENT") + if DEBUG: print " adding ",c2," : ",o.Label + prod2 = ifcfile.createIfcBuildingElementProxy(ifcopenshell.guid.compress(uuid.uuid1().hex),history,o.Label.encode("utf8"),None,None,p2,r2,None,"ELEMENT") ifcfile.createIfcRelAggregates(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'Addition','',product,[prod2]) # subtractions if hasattr(obj,"Subtractions") and (shapetype == "extrusion"): for o in obj.Subtractions: r2,p2,c2 = getRepresentation(ifcfile,context,o,forcebrep=True,subtraction=True) - if DEBUG: print " subtracting ",c2," : ",str(o.Label) - prod2 = ifcfile.createIfcOpeningElement(ifcopenshell.guid.compress(uuid.uuid1().hex),history,str(o.Label),None,None,p2,r2,None) + if DEBUG: print " subtracting ",c2," : ",o.Label + prod2 = ifcfile.createIfcOpeningElement(ifcopenshell.guid.compress(uuid.uuid1().hex),history,o.Label.encode("utf8"),None,None,p2,r2,None) ifcfile.createIfcRelVoidsElement(ifcopenshell.guid.compress(uuid.uuid1().hex),history,'Subtraction','',product,prod2) # properties