Files
IfcOpenShell/src/ifcblenderexport/blenderbim/bim/module/material/add_constituent.py
T
Dion Moult 25fb9be82e WIP port object material assignment with 3 new features. See message. See #1222.
* Full support for editing IfcMaterialList added
 * The reusability of material set relationships are now roundtripped
 * UI is sensitive to IFC schema version and adapts intelligently
2021-01-17 12:46:47 +11:00

17 lines
625 B
Python

import ifcopenshell
class Usecase:
def __init__(self, file, settings=None):
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)
constituent = self.file.create_entity("IfcMaterialConstituent", **{"Material": self.settings["material"]})
constituents.append(constituent)
self.settings["constituent_set"].MaterialConstituents = constituents
return constituent