Files
IfcOpenShell/src/ifcopenshell-python/ifcopenshell/api/material/add_constituent.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
629 B
Python
Raw Normal View History

import ifcopenshell
class Usecase:
2021-03-25 00:54:42 +01:00
def __init__(self, file, settings={}):
self.file = file
self.settings = {"constituent_set": None, "material": None}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
constituents = list(self.settings["constituent_set"].MaterialConstituents or [])
constituent = self.file.create_entity("IfcMaterialConstituent", **{"Material": self.settings["material"]})
constituents.append(constituent)
self.settings["constituent_set"].MaterialConstituents = constituents
return constituent