Fix #1672. Bug where style attributes couldn't be edited.

This commit is contained in:
Dion Moult
2021-08-20 08:50:57 +10:00
parent a0def600e8
commit 6c6d4c047c
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ def draw_attribute(attribute, layout, copy_operator=None):
def import_attributes(ifc_class, props, data, callback=None):
for attribute in IfcStore.get_schema().declaration_by_name(ifc_class).all_attributes():
data_type = ifcopenshell.util.attribute.get_primitive_type(attribute)
if data_type == "entity" or (isinstance(data_type, tuple) and "entity" in ".".join(data_type)):
if isinstance(data_type, tuple) or data_type == "entity":
callback(attribute.name(), None, data) if callback else None
continue
new = props.add()
@@ -3,10 +3,12 @@ def get_primitive_type(attribute_or_data_type):
data_type = str(attribute_or_data_type.type_of_attribute())
else:
data_type = str(attribute_or_data_type)
if "<select" in data_type:
return "select"
elif "<list" in data_type:
return ("list", get_primitive_type(data_type.replace("<list", "")))
if data_type.find("<list") == 0:
return ("list", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
elif data_type.find("<set") == 0:
return ("set", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
elif data_type.find("<select") == 0:
return ("select", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
elif "<entity" in data_type:
return "entity"
elif "<string>" in data_type: