See #3334. Optimise pset getting and add simple "broadphase" filtering for all facets for faster validation.

This commit is contained in:
Dion Moult
2023-07-04 15:50:29 +10:00
parent b8e2e693f1
commit ce8a9293bb
3 changed files with 55 additions and 16 deletions
@@ -77,7 +77,9 @@ def get_pset(element, name, prop=None, should_inherit=True):
if not prop:
if type_pset:
type_pset.update(get_property_definition(pset))
occurrence_pset = get_property_definition(pset)
if occurrence_pset:
type_pset.update(occurrence_pset)
return type_pset
return get_property_definition(pset)
@@ -128,9 +130,10 @@ def get_psets(element, psets_only=False, qtos_only=False, should_inherit=True):
continue
psets[definition.Name] = get_property_definition(definition)
elif hasattr(element, "IsDefinedBy"):
element_type = ifcopenshell.util.element.get_type(element)
if element_type and should_inherit:
psets = get_psets(element_type, psets_only=psets_only, qtos_only=qtos_only, should_inherit=False)
if should_inherit:
element_type = ifcopenshell.util.element.get_type(element)
if element_type:
psets = get_psets(element_type, psets_only=psets_only, qtos_only=qtos_only, should_inherit=False)
for relationship in element.IsDefinedBy:
if relationship.is_a("IfcRelDefinesByProperties"):
definition = relationship.RelatingPropertyDefinition