ifcopenshell.api.system.add_port

Module Contents

ifcopenshell.api.system.add_port.add_port(file: ifcopenshell.file, element: ifcopenshell.entity_instance | None = None) None

Adds a new distribution port to an element

A distribution port represents a connection point on an element, where a distribution element may be connected to another distribution element. For example, a duct segment will typically have two ports, one at either end, because you can attach another segment or fitting to either end of the duct segment.

This will both add a distribution port and automatically assign it to a distribution element.

Parameters:

element (ifcopenshell.entity_instance, optional) – The IfcDistributionElement you want to add a distribution port to.

Returns:

The newly created IfcDistributionPort

Return type:

ifcopenshell.entity_instance

Example:

# Create a duct
duct = ifcopenshell.api.root.create_entity(model,
    ifc_class="IfcDuctSegment", predefined_type="RIGIDSEGMENT")

# Create 2 ports, one for either end.
port1 = ifcopenshell.api.system.add_port(model, element=duct)
port2 = ifcopenshell.api.system.add_port(model, element=duct)