mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Fix #2343. Pset template applicability is refreshed when you save your templates.
This commit is contained in:
@@ -44,18 +44,23 @@ class IfcSchema:
|
|||||||
"IfcAnnotation",
|
"IfcAnnotation",
|
||||||
]
|
]
|
||||||
self.elements = {}
|
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")
|
property_paths = self.data_dir.joinpath("pset").glob("*.ifc")
|
||||||
# TODO: add IFC2X3 PsetQto template support
|
# TODO: add IFC2X3 PsetQto template support
|
||||||
self.psetqto = ifcopenshell.util.pset.get_template("IFC4")
|
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:
|
for path in property_paths:
|
||||||
self.psetqto.templates.append(ifcopenshell.open(path))
|
self.psetqto.templates.append(ifcopenshell.open(path))
|
||||||
|
|
||||||
self.classification_files = {}
|
|
||||||
self.classifications = {}
|
|
||||||
self.load()
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
for product in self.products:
|
for product in self.products:
|
||||||
with open(os.path.join(self.schema_dir, f"{product}_IFC4.json")) as f:
|
with open(os.path.join(self.schema_dir, f"{product}_IFC4.json")) as f:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Usecase:
|
|||||||
self.settings[key] = value
|
self.settings[key] = value
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
self.file.create_entity(
|
return self.file.create_entity(
|
||||||
"IfcPropertySetTemplate",
|
"IfcPropertySetTemplate",
|
||||||
**{
|
**{
|
||||||
"GlobalId": ifcopenshell.guid.new(),
|
"GlobalId": ifcopenshell.guid.new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user