Skip to content

Commit

Permalink
Arch: Fixed encoding in IFC import - fixes #2149
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jun 6, 2015
1 parent 418cefd commit 48113f3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -388,7 +388,9 @@ def insert(filename,docname,skip=[],only=[],root=None):
guid = product.GlobalId
ptype = product.is_a()
if DEBUG: print count,"/",len(products)," creating object ",pid," : ",ptype,
name = product.Name or str(ptype[3:])
name = str(ptype[3:])
if product.Name:
name = product.Name.decode("unicode_escape").encode("utf8")
if PREFIX_NUMBERS: name = "ID" + str(pid) + " " + name
obj = None
baseobj = None
Expand Down Expand Up @@ -514,7 +516,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
for p in properties[pid]:
o = ifcfile[p]
if o.is_a("IfcPropertySingleValue"):
a[o.Name] = str(o.NominalValue)
a[o.Name.decode("unicode_escape").encode("utf8")] = str(o.NominalValue)
obj.IfcAttributes = a

# color
Expand Down Expand Up @@ -601,7 +603,8 @@ def insert(filename,docname,skip=[],only=[],root=None):
if aid in skip: continue # user given id skip list
if "IfcAnnotation" in SKIP: continue # preferences-set type skip list
name = "Annotation"
if annotation.Name: name = annotation.Name
if annotation.Name:
name = annotation.Name.decode("unicode_escape").encode("utf8")
if PREFIX_NUMBERS: name = "ID" + str(aid) + " " + name
shapes2d = []
for repres in annotation.Representation.Representations:
Expand All @@ -622,7 +625,9 @@ def insert(filename,docname,skip=[],only=[],root=None):

fcmats = {}
for material in materials:
name = material.Name or "Material"
name = "Material"
if material.Name:
name = material.Name.decode("unicode_escape").encode("utf8")
if MERGE_MATERIALS and (name in fcmats.keys()):
mat = fcmats[name]
else:
Expand Down

0 comments on commit 48113f3

Please sign in to comment.