Write documentation for root API module

This commit is contained in:
Dion Moult
2022-12-16 15:29:50 +11:00
parent 436482532d
commit 9b3b06adf3
4 changed files with 143 additions and 20 deletions
@@ -20,11 +20,33 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, product=None):
"""Removes a product
This is effectively a smart delete function that not only removes a
product, but also all of its relationships. It is always recommended to
use this function to prevent orphaned data in your IFC model.
For example, geometric representations are removed. Placement
coordinates are also removed. Properties are removed. Material, type,
containment, aggregation, and nesting relationships are removed (but
naturally, the materials, types, containers, etc themselves remain).
:param product: The IfcProduct to remove.
:type product: ifcopenshell.entity_instance.entity_instance
:return: None
:rtype: None
Example::
# We have a wall.
wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")
# No we don't.
ifcopenshell.api.run("root.remove_product", model, product=wall)
"""
self.file = file
self.settings = {"product": None}
for key, value in settings.items():
self.settings[key] = value
self.settings = {"product": product}
def execute(self):
representations = []