mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Hide non-simple property types to avoid breaking UI #5496
Property types that are now skipped (at least in IFC4):
<type IfcArcIndex: <list [3:3] of <type IfcPositiveInteger: <type IfcInteger: <integer>>>>> ('list', 'integer')
<type IfcBinary: <binary>> binary
<type IfcComplexNumber: <array [1:2] of <real>>> ('array', 'float')
<type IfcCompoundPlaneAngleMeasure: <list [3:4] of <integer>>> ('list', 'integer')
<type IfcLineIndex: <list [2:?] of <type IfcPositiveInteger: <type IfcInteger: <integer>>>>> ('list', 'integer')
<type IfcPropertySetDefinitionSet: <set [1:?] of <entity IfcPropertySetDefinition>>> ('set', 'entity')
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.attribute
|
||||
import ifcopenshell.util.doc
|
||||
import ifcopenshell.util.element
|
||||
import bonsai.tool as tool
|
||||
@@ -327,9 +328,15 @@ class AddEditCustomPropertiesData:
|
||||
|
||||
@classmethod
|
||||
def primary_measure_type(cls):
|
||||
SIMPLE_TYPES = {"string", "integer", "float", "boolean"}
|
||||
schema = tool.Ifc.schema()
|
||||
version = tool.Ifc.get_schema()
|
||||
return [
|
||||
(t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description", ""))
|
||||
for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])
|
||||
# Skip non-simple types as they're currently not supported (e.g. IfcBinary and lists/arrays/sets of types).
|
||||
declarations = [
|
||||
d.name()
|
||||
for d in schema.declarations()
|
||||
if hasattr(d, "declared_type") and ifcopenshell.util.attribute.get_primitive_type(d) in SIMPLE_TYPES
|
||||
]
|
||||
return [
|
||||
(t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description", "")) for t in sorted(declarations)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user