mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
Implement sorting of spacial containers by elevation and name
This commit is contained in:
@@ -452,6 +452,10 @@ class Spatial(bonsai.core.tool.Spatial):
|
|||||||
new.is_expanded = element.id() not in cls.contracted_containers
|
new.is_expanded = element.id() not in cls.contracted_containers
|
||||||
new.level_index = level_index
|
new.level_index = level_index
|
||||||
children = ifcopenshell.util.element.get_parts(element)
|
children = ifcopenshell.util.element.get_parts(element)
|
||||||
|
if children:
|
||||||
|
children_elevations = [ifcopenshell.util.placement.get_storey_elevation(el) for el in children]
|
||||||
|
children_names = [[int(x) if x.isdigit() else x for x in (el.Name or "").split()] for el in children]
|
||||||
|
children = sorted(children, key=dict(zip(children, tuple(zip(children_elevations, children_names)))).get)
|
||||||
new.has_children = bool(children)
|
new.has_children = bool(children)
|
||||||
new.ifc_definition_id = element.id()
|
new.ifc_definition_id = element.id()
|
||||||
if new.is_expanded:
|
if new.is_expanded:
|
||||||
|
|||||||
Reference in New Issue
Block a user