mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Fix #1672. Bug where style attributes couldn't be edited.
This commit is contained in:
@@ -53,7 +53,7 @@ def draw_attribute(attribute, layout, copy_operator=None):
|
|||||||
def import_attributes(ifc_class, props, data, callback=None):
|
def import_attributes(ifc_class, props, data, callback=None):
|
||||||
for attribute in IfcStore.get_schema().declaration_by_name(ifc_class).all_attributes():
|
for attribute in IfcStore.get_schema().declaration_by_name(ifc_class).all_attributes():
|
||||||
data_type = ifcopenshell.util.attribute.get_primitive_type(attribute)
|
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
|
callback(attribute.name(), None, data) if callback else None
|
||||||
continue
|
continue
|
||||||
new = props.add()
|
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())
|
data_type = str(attribute_or_data_type.type_of_attribute())
|
||||||
else:
|
else:
|
||||||
data_type = str(attribute_or_data_type)
|
data_type = str(attribute_or_data_type)
|
||||||
if "<select" in data_type:
|
if data_type.find("<list") == 0:
|
||||||
return "select"
|
return ("list", get_primitive_type(data_type[data_type[1:].find("<")+1:]))
|
||||||
elif "<list" in data_type:
|
elif data_type.find("<set") == 0:
|
||||||
return ("list", get_primitive_type(data_type.replace("<list", "")))
|
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:
|
elif "<entity" in data_type:
|
||||||
return "entity"
|
return "entity"
|
||||||
elif "<string>" in data_type:
|
elif "<string>" in data_type:
|
||||||
|
|||||||
Reference in New Issue
Block a user