mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 11:43:53 +00:00
fix bugs in c5c7363a9
This commit is contained in:
@@ -223,11 +223,11 @@ class Attribute(Facet):
|
|||||||
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(ifc_file.schema)
|
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(ifc_file.schema)
|
||||||
entities = {entity.name(): entity for entity in schema.entities()}
|
entities = {entity.name(): entity for entity in schema.entities()}
|
||||||
|
|
||||||
def ignore_subtypes(entity_name):
|
def ignore_subtypes(entity):
|
||||||
entity = entities[entity_name]
|
for subentity in entity.subtypes():
|
||||||
for entity in entity.subtypes():
|
# entity might be already removed as .entities() order is not hierarchical
|
||||||
del entities[entity_name]
|
if entities.pop(subentity.name(), None):
|
||||||
ignore_subtypes(entity)
|
ignore_subtypes(subentity)
|
||||||
|
|
||||||
while entities:
|
while entities:
|
||||||
entity_name, entity = entities.popitem()
|
entity_name, entity = entities.popitem()
|
||||||
@@ -235,8 +235,7 @@ class Attribute(Facet):
|
|||||||
if attribute.name() == self.name:
|
if attribute.name() == self.name:
|
||||||
results.extend(ifc_file.by_type(entity_name, include_subtypes=True))
|
results.extend(ifc_file.by_type(entity_name, include_subtypes=True))
|
||||||
# e.g. if IfcRoot already has .Name, it's safe not to check all it's subtypes attributes
|
# e.g. if IfcRoot already has .Name, it's safe not to check all it's subtypes attributes
|
||||||
ignore_subtypes(entity_name)
|
ignore_subtypes(entity)
|
||||||
del entities[entity_name]
|
|
||||||
|
|
||||||
# TODO: perhaps we should consider value in the filter
|
# TODO: perhaps we should consider value in the filter
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user