mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Write documentation for root API module
This commit is contained in:
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user