mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Make Bonsai IfcApplication identifier unique
To avoid validation errors.
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user