2021-02-24 21:07:27 +11:00
|
|
|
import ifcopenshell
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Usecase:
|
2021-03-27 19:14:32 +11:00
|
|
|
def __init__(self, file, **settings):
|
2021-02-24 21:07:27 +11:00
|
|
|
self.file = file
|
|
|
|
|
self.settings = {"pset_template": None}
|
|
|
|
|
for key, value in settings.items():
|
|
|
|
|
self.settings[key] = value
|
|
|
|
|
|
|
|
|
|
def execute(self):
|
|
|
|
|
prop_template = self.file.create_entity("IfcSimplePropertyTemplate", **{
|
|
|
|
|
"GlobalId": ifcopenshell.guid.new(),
|
|
|
|
|
"Name": "NewProperty",
|
|
|
|
|
"PrimaryMeasureType": "IfcLabel",
|
|
|
|
|
"TemplateType": "P_SINGLEVALUE",
|
|
|
|
|
"AccessState": "READWRITE"
|
|
|
|
|
})
|
2021-03-04 17:26:39 +11:00
|
|
|
has_property_templates = list(self.settings["pset_template"].HasPropertyTemplates or [])
|
2021-02-24 21:07:27 +11:00
|
|
|
has_property_templates.append(prop_template)
|
|
|
|
|
self.settings["pset_template"].HasPropertyTemplates = has_property_templates
|
|
|
|
|
return prop_template
|