ifc2x3 tests

This commit is contained in:
Andrej730
2024-05-15 15:46:45 +05:00
parent bb8e84e5ec
commit 335e2b7a78
10 changed files with 47 additions and 11 deletions
@@ -53,3 +53,7 @@ class TestAddBoolean(test.bootstrap.IFC4):
ifcopenshell.api.run("geometry.add_boolean", self.file, representation=rep, matrix=np.eye(4))
assert rep.Items[0].is_a() == "IfcBooleanClippingResult"
assert rep.RepresentationType == "Clipping"
class TestAddBooleanIFC2X3(test.bootstrap.IFC2X3, TestAddBoolean):
pass
@@ -89,3 +89,7 @@ class TestAssignRepresentation(test.bootstrap.IFC4):
assert wall.Representation.Representations[0].RepresentationType != "MappedRepresentation"
assert wall.Representation.Representations[0] == rep
assert not walltype.RepresentationMaps
class TestAssignRepresentationIFC2X3(test.bootstrap.IFC2X3, TestAssignRepresentation):
pass
@@ -20,7 +20,7 @@ import test.bootstrap
import ifcopenshell.api
class TestConnectPath(test.bootstrap.IFC4):
class TestConnectElement(test.bootstrap.IFC4):
def test_connecting_an_element(self):
wall1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
wall2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
@@ -85,3 +85,7 @@ class TestConnectPath(test.bootstrap.IFC4):
)
assert rel.RelatingElement == wall2
assert rel.RelatedElement == wall1
class TestConnectElementIFC2X3(test.bootstrap.IFC2X3, TestConnectElement):
pass
@@ -146,3 +146,7 @@ class TestConnectPath(test.bootstrap.IFC4):
related_connection=related_connection,
description=description,
)
class TestConnectPathIFC2X3(test.bootstrap.IFC2X3, TestConnectPath):
pass
@@ -20,7 +20,7 @@ import test.bootstrap
import ifcopenshell.api
class TestDisconnectPath(test.bootstrap.IFC4):
class TestDisconnectElement(test.bootstrap.IFC4):
def test_disconnecting_an_element(self):
wall1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
wall2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
@@ -34,3 +34,7 @@ class TestDisconnectPath(test.bootstrap.IFC4):
ifcopenshell.api.run("geometry.connect_element", self.file, relating_element=wall1, related_element=wall2)
ifcopenshell.api.run("geometry.disconnect_element", self.file, relating_element=wall2, related_element=wall1)
assert not self.file.by_type("IfcRelConnectsElements")
class TestDisconnectElementIFC2X3(test.bootstrap.IFC2X3, TestDisconnectElement):
pass
@@ -68,3 +68,7 @@ class TestDisconnectPath(test.bootstrap.IFC4):
total_elements = len([e for e in self.file])
ifcopenshell.api.run("geometry.disconnect_path", self.file, relating_element=wall2, related_element=wall1)
assert len([e for e in self.file]) == total_elements
class TestDisconnectPathIFC2X3(test.bootstrap.IFC2X3, TestDisconnectPath):
pass
@@ -268,7 +268,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
def test_changing_placements_relative_to_a_nest_parent(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", self.file)
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcChiller")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
subelement = ifcopenshell.api.run("system.add_port", self.file, element=element)
matrix = numpy.array(
(
@@ -546,7 +546,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
def test_changing_placements_always_affecting_child_ports_as_a_special_case(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", self.file)
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcChiller")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcFlowSegment")
subelement = ifcopenshell.api.run("system.add_port", self.file, element=element)
matrix = numpy.eye(4)
@@ -662,7 +662,7 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(wall.ObjectPlacement), matrix)
class TestEditObjectPlacementIFC2X3(test.bootstrap.IFC2X3):
class TestEditObjectPlacementIFC2X3(test.bootstrap.IFC2X3, TestEditObjectPlacement):
def test_changing_placements_relative_to_a_distribution_element(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", self.file)
@@ -33,3 +33,7 @@ class TestCreateGridAxis(test.bootstrap.IFC4):
"grid.create_grid_axis", self.file, axis_tag="axis_tag", same_sense=True, uvw_axes="UAxes", grid=grid
)
assert grid.UAxes == (axis, axis2)
class TestCreateGridAxisIFC2X3(test.bootstrap.IFC2X3, TestCreateGridAxis):
pass
@@ -27,7 +27,7 @@ class TestRemoveGroup(test.bootstrap.IFC4):
assert len(self.file.by_type("IfcGroup")) == 0
def test_removing_orphaned_group_relationships(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file)
ifcopenshell.api.run("group.assign_group", self.file, products=[element], group=group)
ifcopenshell.api.run("group.remove_group", self.file, group=group)
@@ -41,3 +41,7 @@ class TestRemoveGroup(test.bootstrap.IFC4):
assert not self.file.by_type("IfcRelDefinesByProperties")
assert not self.file.by_type("IfcPropertySet")
assert not self.file.by_type("IfcPropertySingleValue")
class TestRemoveGroupIFC2X3(test.bootstrap.IFC2X3, TestRemoveGroup):
pass
@@ -22,9 +22,9 @@ import ifcopenshell.api
class TestAssignGroup(test.bootstrap.IFC4):
def test_group_unassignment(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element3 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element3 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file)
ifcopenshell.api.run("group.assign_group", self.file, products=[element, element2, element3], group=group)
ifcopenshell.api.run("group.unassign_group", self.file, products=[element2, element3], group=group)
@@ -35,9 +35,13 @@ class TestAssignGroup(test.bootstrap.IFC4):
assert rel.RelatedObjects == (element,)
def test_remove_relationship_unassigning_last_element(self):
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcPump")
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
group = ifcopenshell.api.run("group.add_group", self.file)
ifcopenshell.api.run("group.assign_group", self.file, products=[element, element2], group=group)
ifcopenshell.api.run("group.unassign_group", self.file, products=[element, element2], group=group)
assert len(self.file.by_type("IfcRelAssignsToGroup")) == 0
class TestAssignGroupIFC2X3(test.bootstrap.IFC2X3, TestAssignGroup):
pass