Fix #2343. Pset template applicability is refreshed when you save your templates.

This commit is contained in:
Dion Moult
2022-09-01 18:25:00 +10:00
parent a800d1af7e
commit f9db685753
2 changed files with 11 additions and 6 deletions
+10 -5
View File
@@ -44,18 +44,23 @@ class IfcSchema:
"IfcAnnotation",
]
self.elements = {}
self.classification_files = {}
self.classifications = {}
self.load_pset_templates()
self.load()
self.property_files = []
def load_pset_templates(self):
property_paths = self.data_dir.joinpath("pset").glob("*.ifc")
# TODO: add IFC2X3 PsetQto template support
self.psetqto = ifcopenshell.util.pset.get_template("IFC4")
# Keep only the first template, which is the official buildingSMART one
self.psetqto.templates = self.psetqto.templates[0:1]
self.psetqto.get_applicable.cache_clear()
self.psetqto.get_applicable_names.cache_clear()
self.psetqto.get_by_name.cache_clear()
for path in property_paths:
self.psetqto.templates.append(ifcopenshell.open(path))
self.classification_files = {}
self.classifications = {}
self.load()
def load(self):
for product in self.products:
with open(os.path.join(self.schema_dir, f"{product}_IFC4.json")) as f:
@@ -27,7 +27,7 @@ class Usecase:
self.settings[key] = value
def execute(self):
self.file.create_entity(
return self.file.create_entity(
"IfcPropertySetTemplate",
**{
"GlobalId": ifcopenshell.guid.new(),