Arch: Renamed Role property to IfcRole

This commit is contained in:
Yorik van Havre
2018-05-11 12:01:55 -03:00
parent 03908877fc
commit 63794fcefd
15 changed files with 112 additions and 49 deletions

View File

@@ -676,16 +676,20 @@ def insert(filename,docname,skip=[],only=[],root=None):
baseobj.ViewObject.hide()
# setting role
try:
r = ptype[3:]
tr = dict((v,k) for k, v in translationtable.iteritems())
if r in tr.keys():
r = tr[r]
# remove the "StandardCase"
if "StandardCase" in r:
r = r[:-12]
obj.Role = r
if hasattr(obj,"IfcRole"):
obj.IfcRole = ptype[3:]
else:
# pre-0.18 objects, only support a small subset of types
r = ptype[3:]
tr = dict((v,k) for k, v in translationtable.iteritems())
if r in tr.keys():
r = tr[r]
# remove the "StandardCase"
if "StandardCase" in r:
r = r[:-12]
obj.Role = r
except:
pass
print("Unable to give IFC role ",ptype," to object ",obj.Label)
# setting uid
if hasattr(obj,"IfcAttributes"):
a = obj.IfcAttributes
@@ -1115,7 +1119,9 @@ def export(exportList,filename):
obj.IfcAttributes = d
# setting the IFC type + name conversions
if hasattr(obj,"Role"):
if hasattr(obj,"IfcRole"):
ifctype = obj.IfcRole.replace(" ","")
elif hasattr(obj,"Role"):
ifctype = obj.Role.replace(" ","")
else:
ifctype = Draft.getType(obj)
@@ -1127,10 +1133,8 @@ def export(exportList,filename):
if ifctype == "IfcGroup":
groups[obj.Name] = [o.Name for o in obj.Group]
continue
ifctypes = []
for v in typesmap.values():
ifctypes.extend(v)
if ifctype not in ifctypes:
from ArchComponent import IFCTYPES
if ifctype not in IFCTYPES:
ifctype = "IfcBuildingElementProxy"
# getting the "Force BREP" flag