Module Contents

ifcopenshell.api.system.add_port.add_port(file, element=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.


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


The newly created IfcDistributionPort

Return type:



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

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