IfcTester now supports new entityType data in partof facet

This commit is contained in:
Dion Moult
2022-10-07 13:11:52 +11:00
parent 61f4c48a4a
commit 1677a6c83f
3 changed files with 77 additions and 12 deletions
+29 -1
View File
@@ -1404,13 +1404,17 @@ class TestPartOf:
assert facet.asdict() == {"@relation": "IfcRelAggregates"}
facet = PartOf(
entity="IfcGroup",
predefinedType="predefinedType",
relation="IfcRelAssignsToGroup",
minOccurs="0",
maxOccurs="unbounded",
instructions="instructions",
)
assert facet.asdict() == {
"entity": {"simpleValue": "IfcGroup"},
"entity": {
"name": {"simpleValue": "IfcGroup"},
"predefinedType": {"simpleValue": "predefinedType"},
},
"@relation": "IfcRelAssignsToGroup",
"@minOccurs": "0",
"@maxOccurs": "unbounded",
@@ -1446,6 +1450,12 @@ class TestPartOf:
facet = PartOf(entity="IFCWALL", relation="IfcRelAggregates")
run("An aggregate may specify the entity of the whole 2/2", facet=facet, inst=subelement, expected=False)
element.PredefinedType = "BASESLAB"
facet = PartOf(entity="IFCSLAB", predefinedType="BASESLAB", relation="IfcRelAggregates")
run("An aggregate may specify the predefined type of the whole 1/2", facet=facet, inst=subelement, expected=True)
facet = PartOf(entity="IFCSLAB", predefinedType="SLABRADOR", relation="IfcRelAggregates")
run("An aggregate may specify the predefined type of the whole 2/2", facet=facet, inst=subelement, expected=False)
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
@@ -1472,6 +1482,12 @@ class TestPartOf:
facet = PartOf(entity="IFCINVENTORY", relation="IfcRelAssignsToGroup")
run("A group entity must match exactly 2/2", facet=facet, inst=element, expected=True)
group.ObjectType = "BUNNY"
facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNARY", relation="IfcRelAssignsToGroup")
run("A group predefined type must match exactly 2/2", facet=facet, inst=element, expected=False)
facet = PartOf(entity="IFCINVENTORY", predefinedType="BUNNY", relation="IfcRelAssignsToGroup")
run("A group predefined type must match exactly 2/2", facet=facet, inst=element, expected=True)
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcElementAssembly")
container = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSpace")
@@ -1490,6 +1506,12 @@ class TestPartOf:
facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE")
run("The container entity must match exactly 2/2", facet=facet, inst=element, expected=True)
container.ObjectType = "BURROW"
facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE", predefinedType="WARREN")
run("The container predefined type must match exactly 1/2", facet=facet, inst=element, expected=False)
facet = PartOf(relation="IfcRelContainedInSpatialStructure", entity="IFCSPACE", predefinedType="BURROW")
run("The container predefined type must match exactly 2/2", facet=facet, inst=element, expected=True)
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcSlab")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBeam")
@@ -1516,6 +1538,12 @@ class TestPartOf:
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE")
run("The nest entity must match exactly 2/2", facet=facet, inst=subelement, expected=True)
element.ObjectType = "WATERBOTTLE"
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="LITTERBOX")
run("The nest predefined type must match exactly 1/2", facet=facet, inst=subelement, expected=False)
facet = PartOf(relation="IfcRelNests", entity="IFCFURNITURE", predefinedType="WATERBOTTLE")
run("The nest predefined type must match exactly 2/2", facet=facet, inst=subelement, expected=True)
ifc = ifcopenshell.file()
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcFurniture")
subelement = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcDiscreteAccessory")