mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 06:18:09 +00:00
get_pset() fix bug getting inherited psets with psets_only/qtos_only = True
This commit is contained in:
@@ -94,11 +94,13 @@ def get_pset(
|
|||||||
elif qtos_only and not pset.is_a("IfcElementQuantity"):
|
elif qtos_only and not pset.is_a("IfcElementQuantity"):
|
||||||
pset = None
|
pset = None
|
||||||
|
|
||||||
if type_pset is not None:
|
if type_pset is not None and not prop:
|
||||||
if psets_only and not type_pset.is_a("IfcPropertySet"):
|
if psets_only or qtos_only:
|
||||||
type_pset = None
|
type_pset_element = element.file.by_id(type_pset["id"])
|
||||||
elif qtos_only and not type_pset.is_a("IfcElementQuantity"):
|
if psets_only and not type_pset_element.is_a("IfcPropertySet"):
|
||||||
type_pset = None
|
type_pset = None
|
||||||
|
elif qtos_only and not type_pset_element.is_a("IfcElementQuantity"):
|
||||||
|
type_pset = None
|
||||||
|
|
||||||
if pset is None and type_pset is None:
|
if pset is None and type_pset is None:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
|||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"z": False})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"z": False})
|
||||||
assert subject.get_pset(element, "name2", "z") is False
|
assert subject.get_pset(element, "name2", "z") is False
|
||||||
|
|
||||||
|
# test filters with inherited psets
|
||||||
|
assert subject.get_pset(element, "name", psets_only=True) == result
|
||||||
|
assert subject.get_pset(element, "name", qtos_only=True) == None
|
||||||
|
|
||||||
def test_excluding_inherited_psets(self):
|
def test_excluding_inherited_psets(self):
|
||||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||||
type_element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
type_element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWallType")
|
||||||
|
|||||||
Reference in New Issue
Block a user