mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
typing
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user