Add API docs for drawing module

This commit is contained in:
Dion Moult
2022-11-23 11:23:40 +09:00
parent b23f445946
commit 4b20a407e9
3 changed files with 86 additions and 14 deletions
@@ -21,14 +21,38 @@ import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, relating_product=None, related_object=None):
"""Unassigns a product and an object (typically an annotation)
Smart annotation objects can be associated with products so that they
can annotate attributes and properties. This function lets you remove
the association, so that you may change the assocation with another
object later or leave the annotation as a "dumb" annotation.
:param relating_product: The IfcProduct the object is related to
:type relating_product: ifcopenshell.entity_instance.entity_instance
:param related_object: The object (typically IfcAnnotation) that the
product is related to
:type related_object: ifcopenshell.entity_instance.entity_instance
:return: The created IfcRelAssignsToProduct relationship
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
furniture = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcFurniture")
annotation = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcAnnotation")
ifcopenshell.api.run("drawing.assign_product", model,
relating_product=furniture, related_object=annotation)
# Let's change our mind and remove the relationship
ifcopenshell.api.run("drawing.unassign_product", model,
relating_product=furniture, related_object=annotation)
"""
self.file = file
self.settings = {
"relating_product": None,
"related_object": None,
"relating_product": relating_product,
"related_object": related_object,
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
for rel in self.settings["related_object"].HasAssignments or []: