Arch: Fixed encoding in IFC import - fixes #2149
This commit is contained in:
parent
418cefd7ee
commit
48113f3bca
|
@ -388,7 +388,9 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||||
guid = product.GlobalId
|
guid = product.GlobalId
|
||||||
ptype = product.is_a()
|
ptype = product.is_a()
|
||||||
if DEBUG: print count,"/",len(products)," creating object ",pid," : ",ptype,
|
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
|
if PREFIX_NUMBERS: name = "ID" + str(pid) + " " + name
|
||||||
obj = None
|
obj = None
|
||||||
baseobj = None
|
baseobj = None
|
||||||
|
@ -514,7 +516,7 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||||
for p in properties[pid]:
|
for p in properties[pid]:
|
||||||
o = ifcfile[p]
|
o = ifcfile[p]
|
||||||
if o.is_a("IfcPropertySingleValue"):
|
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
|
obj.IfcAttributes = a
|
||||||
|
|
||||||
# color
|
# color
|
||||||
|
@ -601,7 +603,8 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||||
if aid in skip: continue # user given id skip list
|
if aid in skip: continue # user given id skip list
|
||||||
if "IfcAnnotation" in SKIP: continue # preferences-set type skip list
|
if "IfcAnnotation" in SKIP: continue # preferences-set type skip list
|
||||||
name = "Annotation"
|
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
|
if PREFIX_NUMBERS: name = "ID" + str(aid) + " " + name
|
||||||
shapes2d = []
|
shapes2d = []
|
||||||
for repres in annotation.Representation.Representations:
|
for repres in annotation.Representation.Representations:
|
||||||
|
@ -622,7 +625,9 @@ def insert(filename,docname,skip=[],only=[],root=None):
|
||||||
|
|
||||||
fcmats = {}
|
fcmats = {}
|
||||||
for material in materials:
|
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()):
|
if MERGE_MATERIALS and (name in fcmats.keys()):
|
||||||
mat = fcmats[name]
|
mat = fcmats[name]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user