Make Bonsai IfcApplication identifier unique

To avoid validation errors.
This commit is contained in:
Andrej730
2025-06-20 13:09:16 +05:00
parent 4f03c7e03e
commit 6599f74d11
+3 -2
View File
@@ -287,14 +287,15 @@ def get_application(ifc: ifcopenshell.file) -> ifcopenshell.entity_instance:
# Use only main part from the version to avoid flooding advanced users projects with IfcApplications. # Use only main part from the version to avoid flooding advanced users projects with IfcApplications.
version = tool.Blender.get_bonsai_version().split("-")[0] version = tool.Blender.get_bonsai_version().split("-")[0]
identifier = f"Bonsai-{version}"
for element in ifc.by_type("IfcApplication"): for element in ifc.by_type("IfcApplication"):
if element.ApplicationIdentifier == "Bonsai" and element.Version == version: if element.ApplicationIdentifier == identifier:
return element return element
application = ifcopenshell.api.owner.add_application( application = ifcopenshell.api.owner.add_application(
ifc, ifc,
version=version, version=version,
application_full_name="Bonsai", application_full_name="Bonsai",
application_identifier="Bonsai", application_identifier=identifier,
) )
SettingsCache.APPLICATION_ID = application.id() SettingsCache.APPLICATION_ID = application.id()
SettingsCache.set_file(ifc) SettingsCache.set_file(ifc)