mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Fix #4490. Fix fundamental bug where get_pset would return none for inherited props with a boolean False value.
This commit is contained in:
@@ -209,7 +209,7 @@ class ImportFilterQueryTransformer(lark.Transformer):
|
|||||||
return (
|
return (
|
||||||
is_not
|
is_not
|
||||||
+ {
|
+ {
|
||||||
"equals": "", # Blank because it's the default situation
|
"equals": "=" if is_not else "", # Blank because it's the default situation
|
||||||
"morethanequalto": ">=",
|
"morethanequalto": ">=",
|
||||||
"lessthanequalto": "<=",
|
"lessthanequalto": "<=",
|
||||||
"morethan": ">",
|
"morethan": ">",
|
||||||
|
|||||||
@@ -93,13 +93,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:
|
if type_pset is not None:
|
||||||
if psets_only and not type_pset.is_a("IfcPropertySet"):
|
if psets_only and not type_pset.is_a("IfcPropertySet"):
|
||||||
type_pset = None
|
type_pset = None
|
||||||
elif qtos_only and not type_pset.is_a("IfcElementQuantity"):
|
elif qtos_only and not type_pset.is_a("IfcElementQuantity"):
|
||||||
type_pset = None
|
type_pset = None
|
||||||
|
|
||||||
if not pset and not type_pset:
|
if not pset and type_pset is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not prop:
|
if not prop:
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ class TestGetPsetIFC4(test.bootstrap.IFC4):
|
|||||||
assert subject.get_pset(element, "name", "a") == 2
|
assert subject.get_pset(element, "name", "a") == 2
|
||||||
assert subject.get_pset(element, "name", "x") == 1
|
assert subject.get_pset(element, "name", "x") == 1
|
||||||
assert subject.get_pset(element, "name", "b") == 3
|
assert subject.get_pset(element, "name", "b") == 3
|
||||||
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=type_element, name="name2")
|
||||||
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"z": False})
|
||||||
|
assert subject.get_pset(element, "name2", "z") is False
|
||||||
|
|
||||||
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")
|
||||||
|
|||||||
Reference in New Issue
Block a user