Write docs for system API module

This commit is contained in:
Dion Moult
2023-01-04 16:09:26 +11:00
parent b86818ead3
commit 92623b98e2
10 changed files with 322 additions and 47 deletions
@@ -21,14 +21,38 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, element=None, port=None):
"""Unassigns a port to an element
Ports are typically always assigned to a distribution element, but in
some edge cases you may want to unassign the port to create an orphaned
port for cleaning or patchin purposes.
:param element: The IfcDistributionElement to unassign the port from.
:type element: ifcopenshell.entity_instance.entity_instance
:param port: The IfcDistributionPort you want to unassign.
:type port: ifcopenshell.entity_instance.entity_instance
:return: None
:rtype: None
Example::
# 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)
# Unassign one port for some weird reason.
ifcopenshell.api.run("system.unassign_port", model, element=duct, port=port1)
"""
self.file = file
self.settings = {
"element": None,
"port": None,
"element": element,
"port": port,
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
if self.file.schema == "IFC2X3":