mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Add support for descriptions in path connection relationships
This commit is contained in:
@@ -28,6 +28,7 @@ class Usecase:
|
||||
"related_element": None,
|
||||
"relating_connection": "NOTDEFINED",
|
||||
"related_connection": "NOTDEFINED",
|
||||
"description": None,
|
||||
}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
@@ -73,6 +74,7 @@ class Usecase:
|
||||
return self.file.createIfcRelConnectsPathElements(
|
||||
ifcopenshell.guid.new(),
|
||||
OwnerHistory=ifcopenshell.api.run("owner.create_owner_history", self.file),
|
||||
Description=self.settings["description"],
|
||||
RelatingElement=self.settings["relating_element"],
|
||||
RelatedElement=self.settings["related_element"],
|
||||
RelatingConnectionType=self.settings["relating_connection"],
|
||||
|
||||
@@ -24,12 +24,13 @@ class TestConnectPath(test.bootstrap.IFC4):
|
||||
def test_connecting_a_path(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")
|
||||
rel = self.connect_path(wall1, wall2, "ATSTART", "ATEND")
|
||||
rel = self.connect_path(wall1, wall2, "ATSTART", "ATEND", description="MITRE")
|
||||
assert rel.is_a("IfcRelConnectsPathElements")
|
||||
assert rel.RelatingElement == wall1
|
||||
assert rel.RelatedElement == wall2
|
||||
assert rel.RelatingConnectionType == "ATSTART"
|
||||
assert rel.RelatedConnectionType == "ATEND"
|
||||
assert rel.Description == "MITRE"
|
||||
|
||||
def test_doing_nothing_if_the_element_is_already_connected(self):
|
||||
wall1 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
@@ -129,7 +130,12 @@ class TestConnectPath(test.bootstrap.IFC4):
|
||||
assert len(self.file.by_type("IfcRelConnectsPathElements")) == 1
|
||||
|
||||
def connect_path(
|
||||
self, relating_element, related_element, relating_connection="NOTDEFINED", related_connection="NOTDEFINED"
|
||||
self,
|
||||
relating_element,
|
||||
related_element,
|
||||
relating_connection="NOTDEFINED",
|
||||
related_connection="NOTDEFINED",
|
||||
description=None,
|
||||
):
|
||||
return ifcopenshell.api.run(
|
||||
"geometry.connect_path",
|
||||
@@ -138,4 +144,5 @@ class TestConnectPath(test.bootstrap.IFC4):
|
||||
related_element=related_element,
|
||||
relating_connection=relating_connection,
|
||||
related_connection=related_connection,
|
||||
description=description,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user