Add API docs for constraint module

This commit is contained in:
Dion Moult
2022-11-16 08:56:55 +09:00
parent ff2714d991
commit 22b4bfe07d
8 changed files with 159 additions and 33 deletions
@@ -20,11 +20,29 @@ import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file):
"""Add a new objective constraint
Parametric constraints may be defined by the user. The constraint is defined
by first creating an objective describing the purpose of the constraint and
whether it is a hard or soft constraint. Later on, metrics may be added to
check whether the constraint has been met by connecting it to properties and
quantities. See ifcopenshell.api.constraint.add_metric for more information.
:return: The newly created IfcObjective entity
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
# Create a new objective for code compliance requirements
objective = ifcopenshell.api.run("constraint.add_objective", model)
objective.ConstraintGrade = "ADVISORY"
objective.ObjectiveQualifier = "CODECOMPLIANCE"
# Note: the objective right now is purely qualitative and for
# information purposes. You may wish to add quantiative metrics.
"""
self.file = file
self.settings = {}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
return self.file.create_entity(