2021-01-17 12:46:35 +11:00
|
|
|
import ifcopenshell
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Usecase:
|
2021-03-27 19:14:32 +11:00
|
|
|
def __init__(self, file, **settings):
|
2021-01-17 12:46:35 +11:00
|
|
|
self.file = file
|
|
|
|
|
self.settings = {"constituent_set": None, "material": None}
|
|
|
|
|
for key, value in settings.items():
|
|
|
|
|
self.settings[key] = value
|
|
|
|
|
|
|
|
|
|
def execute(self):
|
2021-03-08 08:40:56 +11:00
|
|
|
constituents = list(self.settings["constituent_set"].MaterialConstituents or [])
|
2021-01-17 12:46:35 +11:00
|
|
|
constituent = self.file.create_entity("IfcMaterialConstituent", **{"Material": self.settings["material"]})
|
|
|
|
|
constituents.append(constituent)
|
|
|
|
|
self.settings["constituent_set"].MaterialConstituents = constituents
|
|
|
|
|
return constituent
|