mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Save blenderbim last commit hash to the ifc header
Now it's possible to identify blenderbim version from .ifc file which is useful for debugging
Example:
FILE_NAME('test.ifc','2023-08-22T18:07:07+05:00',(),(),'IfcOpenShell v0.7.0-fc50bdd3a','BlenderBIM 0.0.999999-64bc7af','Nobody');
This commit is contained in:
@@ -82,7 +82,7 @@ class IfcExporter:
|
||||
)
|
||||
self.file.wrapped_data.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version)
|
||||
self.file.wrapped_data.header.file_name.originating_system = "{} {}".format(
|
||||
self.get_application_name(), self.get_application_version()
|
||||
self.get_application_name(), tool.Blender.get_blenderbim_version()
|
||||
)
|
||||
|
||||
def sync_all_objects(self):
|
||||
@@ -162,7 +162,7 @@ class IfcExporter:
|
||||
return "BlenderBIM"
|
||||
|
||||
def get_application_version(self):
|
||||
return ".".join(
|
||||
version = ".".join(
|
||||
[
|
||||
str(x)
|
||||
for x in [
|
||||
@@ -172,6 +172,9 @@ class IfcExporter:
|
||||
][0]
|
||||
]
|
||||
)
|
||||
if blenderbim.bim.last_commit_hash != "8888888":
|
||||
version += f"-{blenderbim.bim.last_commit_hash[:7]}"
|
||||
return version
|
||||
|
||||
|
||||
class IfcExportSettings:
|
||||
|
||||
@@ -464,6 +464,7 @@ class BIM_PT_tab_quality_control(Panel):
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
|
||||
class BIM_PT_tab_clash_detection(Panel):
|
||||
bl_label = "Clash Detection"
|
||||
bl_space_type = "PROPERTIES"
|
||||
@@ -477,6 +478,7 @@ class BIM_PT_tab_clash_detection(Panel):
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
|
||||
class BIM_PT_tab_sandbox(Panel):
|
||||
bl_label = "Sandbox"
|
||||
bl_space_type = "PROPERTIES"
|
||||
@@ -658,24 +660,13 @@ class UIData:
|
||||
|
||||
@classmethod
|
||||
def version(cls):
|
||||
return ".".join(
|
||||
[
|
||||
str(x)
|
||||
for x in [
|
||||
addon.bl_info.get("version", (-1, -1, -1))
|
||||
for addon in addon_utils.modules()
|
||||
if addon.bl_info["name"] == "BlenderBIM"
|
||||
][0]
|
||||
]
|
||||
)
|
||||
return tool.Blender.get_blenderbim_version()
|
||||
|
||||
|
||||
def draw_statusbar(self, context):
|
||||
if not UIData.is_loaded:
|
||||
UIData.load()
|
||||
text = f"BlenderBIM Add-on v{UIData.data['version']}"
|
||||
if blenderbim.bim.last_commit_hash != "8888888":
|
||||
text += f"-{blenderbim.bim.last_commit_hash[:7]}"
|
||||
self.layout.label(text=text)
|
||||
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@ import bpy
|
||||
import json
|
||||
import ifcopenshell.api
|
||||
import blenderbim.tool as tool
|
||||
import blenderbim.bim
|
||||
from mathutils import Vector
|
||||
from pathlib import Path
|
||||
import addon_utils
|
||||
|
||||
|
||||
VIEWPORT_ATTRIBUTES = [
|
||||
@@ -588,3 +590,19 @@ class Blender:
|
||||
child_obj = tool.Blender.get_object_from_guid(child_guid)
|
||||
if child_obj:
|
||||
yield child_obj
|
||||
|
||||
@classmethod
|
||||
def get_blenderbim_version(cls):
|
||||
version = ".".join(
|
||||
[
|
||||
str(x)
|
||||
for x in [
|
||||
addon.bl_info.get("version", (-1, -1, -1))
|
||||
for addon in addon_utils.modules()
|
||||
if addon.bl_info["name"] == "BlenderBIM"
|
||||
][0]
|
||||
]
|
||||
)
|
||||
if blenderbim.bim.last_commit_hash != "8888888":
|
||||
version += f"-{blenderbim.bim.last_commit_hash[:7]}"
|
||||
return version
|
||||
|
||||
Reference in New Issue
Block a user