This commit is contained in:
Andrej730
2024-05-10 11:21:53 +05:00
parent e7eb00eaa3
commit c50d1ea2fe
105 changed files with 502 additions and 251 deletions
@@ -22,7 +22,9 @@ import ifcopenshell.guid
import ifcopenshell.util.placement
def assign_port(file, element=None, port=None) -> None:
def assign_port(
file: ifcopenshell.file, element: ifcopenshell.entity_instance, port: ifcopenshell.entity_instance
) -> ifcopenshell.entity_instance:
"""Assigns a port to an element
If you have an orphaned port, you may assign it to a distribution
@@ -73,7 +75,7 @@ class Usecase:
for rel in rels:
if self.settings["port"] in rel.RelatedObjects:
return
return rel
if rels:
rel = rels[0]
@@ -97,7 +99,7 @@ class Usecase:
def execute_ifc2x3(self):
for rel in self.settings["element"].HasPorts or []:
if rel.RelatingPort == self.settings["port"]:
return
return rel
rel = self.file.create_entity(
"IfcRelConnectsPortToElement",
GlobalId=ifcopenshell.guid.new(),