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,13 +20,29 @@ import ifcopenshell
class Usecase:
def __init__(self, file, **settings):
def __init__(self, file, objective=None):
"""Add a new metric benchmark
Qualitative constraints may have a series of quantitative benchmarks
linked to it known as metrics. Metrics may be parametrically linked to
computed model properties or quantities. Metrics need to be satisfied
to meet the objective of the constraint.
:param objective: The IfcObjective that this metric is a benchmark of.
:type objective: ifcopenshell.entity_instance.entity_instance
:return: The newly created IfcMetric entity
:rtype: ifcopenshell.entity_instance.entity_instance
Example::
objective = ifcopenshell.api.run("constraint.add_objective", model)
metric = ifcopenshell.api.run("constraint.add_metric", model,
objective=objective)
"""
self.file = file
self.settings = {
"objective": None,
"objective": objective,
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
metric = self.file.create_entity(