mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
Add API docs for constraint module
This commit is contained in:
@@ -18,11 +18,29 @@
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
def __init__(self, file, metric=None, attributes=None):
|
||||
"""Edit the attributes of a metric
|
||||
|
||||
For more information about the attributes and data types of an
|
||||
IfcMetric, consult the IFC documentation.
|
||||
|
||||
:param metric: The IfcMetric you want to edit.
|
||||
:type metric: ifcopenshell.entity_instance.entity_instance
|
||||
:param attributes: a dictionary of attribute names and values.
|
||||
:type attributes: dict, optional
|
||||
:return: None
|
||||
:rtype: None
|
||||
|
||||
Example::
|
||||
|
||||
objective = ifcopenshell.api.run("constraint.add_objective", model)
|
||||
metric = ifcopenshell.api.run("constraint.add_metric", model,
|
||||
objective=objective)
|
||||
ifcopenshell.api.run("constraint.edit_metric", model,
|
||||
metric=metric, attributes={"ConstraintGrade": "HARD"})
|
||||
"""
|
||||
self.file = file
|
||||
self.settings = {"metric": None, "attributes": {}}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
self.settings = {"metric": metric, "attributes": attributes or {}}
|
||||
|
||||
def execute(self):
|
||||
for name, value in self.settings["attributes"].items():
|
||||
|
||||
Reference in New Issue
Block a user