mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 11:20:21 +00:00
22 lines
649 B
Python
22 lines
649 B
Python
|
|
import ifcopenshell
|
||
|
|
|
||
|
|
class Usecase:
|
||
|
|
def __init__(self, file, **settings):
|
||
|
|
self.file = file
|
||
|
|
self.settings = {
|
||
|
|
"objective": None,
|
||
|
|
}
|
||
|
|
for key, value in settings.items():
|
||
|
|
self.settings[key] = value
|
||
|
|
|
||
|
|
def execute(self):
|
||
|
|
metric = self.file.create_entity("IfcMetric", **{
|
||
|
|
"Name": "Unnamed",
|
||
|
|
"ConstraintGrade": "NOTDEFINED",
|
||
|
|
"Benchmark": "EQUALTO",
|
||
|
|
})
|
||
|
|
if self.settings["objective"]:
|
||
|
|
benchmark_values = list(self.settings["objective"].BenchmarkValues or [])
|
||
|
|
benchmark_values.append(metric)
|
||
|
|
return metric
|