Fix #4086. Add support for non predefined bSDD pset and qto values.

This commit is contained in:
Dion Moult
2023-12-08 15:07:46 +11:00
parent dbb9e8c907
commit 7c89d072e2
5 changed files with 60 additions and 18 deletions
@@ -19,7 +19,7 @@
import ifcopenshell
def get_pset(element, name, prop=None, should_inherit=True, verbose=False):
def get_pset(element, name, prop=None, psets_only=False, qtos_only=False, should_inherit=True, verbose=False):
"""Retrieve a single property set or single property
This is more efficient than ifcopenshell.util.element.get_psets if you know
@@ -34,6 +34,10 @@ def get_pset(element, name, prop=None, should_inherit=True, verbose=False):
:type name: str
:param prop: The name of the property
:type prop: str,optional
:param psets_only: Default as False. Set to true if only property sets are needed.
:type psets_only: bool,optional
:param qtos_only: Default as False. Set to true if only quantities are needed.
:type qtos_only: bool,optional
:param should_inherit: Default as True. Set to false if you don't want to inherit property sets from the Type.
:type should_inherit: bool,optional
:return: A dictionary of property names and values, or a single value if a
@@ -72,6 +76,18 @@ def get_pset(element, name, prop=None, should_inherit=True, verbose=False):
pset = definition
break
if pset:
if psets_only and not pset.is_a("IfcPropertySet"):
pset = None
elif qtos_only and not pset.is_a("IfcElementQuantity"):
pset = None
if type_pset:
if psets_only and not type_pset.is_a("IfcPropertySet"):
type_pset = None
elif qtos_only and not type_pset.is_a("IfcElementQuantity"):
type_pset = None
if not pset and not type_pset:
return