mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 10:34:31 +00:00
Fix #7213. IfcTester now supports checking for USERDEFINED predefined types
Can I just take this moment to complain about the overengineered complexity of how predefined types work in IFC.
This commit is contained in:
@@ -227,8 +227,13 @@ class Entity(Facet):
|
||||
reason = {"type": "NAME", "actual": inst.is_a().upper()}
|
||||
|
||||
if is_pass and self.predefinedType:
|
||||
predefined_type = ifcopenshell.util.element.get_predefined_type(inst)
|
||||
is_pass = predefined_type == self.predefinedType
|
||||
if self.predefinedType == "USERDEFINED":
|
||||
is_pass = ifcopenshell.util.element.is_userdefined_type(inst)
|
||||
if not is_pass:
|
||||
predefined_type = ifcopenshell.util.element.get_predefined_type(inst)
|
||||
else:
|
||||
predefined_type = ifcopenshell.util.element.get_predefined_type(inst)
|
||||
is_pass = predefined_type == self.predefinedType
|
||||
|
||||
if not is_pass:
|
||||
reason = {"type": "PREDEFINEDTYPE", "actual": predefined_type}
|
||||
|
||||
@@ -172,10 +172,10 @@ class TestEntity:
|
||||
facet = Entity(name="IFCWALL", predefinedType="USERDEFINED")
|
||||
ifc = ifcopenshell.file()
|
||||
run(
|
||||
"A predefined type must always specify a meaningful type, not USERDEFINED itself",
|
||||
"A predefined type may specify USERDEFINED itself",
|
||||
facet=facet,
|
||||
inst=ifc.createIfcWall(PredefinedType="USERDEFINED", ObjectType="WALDO"),
|
||||
expected=False,
|
||||
expected=True,
|
||||
)
|
||||
|
||||
ifc = ifcopenshell.file()
|
||||
|
||||
Reference in New Issue
Block a user