mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
New feature to visualise IFC diff changes
This commit is contained in:
@@ -118,6 +118,7 @@ if bpy is not None:
|
||||
operator.OpenView,
|
||||
operator.ActivateView,
|
||||
operator.ExecuteIfcDiff,
|
||||
operator.VisualiseDiff,
|
||||
operator.ExportClashSets,
|
||||
operator.ImportClashSets,
|
||||
operator.AddClashSet,
|
||||
|
||||
@@ -1352,6 +1352,27 @@ class SelectDiffJsonFile(bpy.types.Operator):
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
class VisualiseDiff(bpy.types.Operator):
|
||||
bl_idname = 'bim.visualise_diff'
|
||||
bl_label = 'Visualise Diff'
|
||||
|
||||
def execute(self, context):
|
||||
with open(bpy.context.scene.BIMProperties.diff_json_file, 'r') as file:
|
||||
diff = json.load(file)
|
||||
for obj in bpy.context.visible_objects:
|
||||
obj.color = (1., 1., 1., .2)
|
||||
global_id = obj.BIMObjectProperties.attributes.get('GlobalId')
|
||||
if not global_id:
|
||||
continue
|
||||
if global_id.string_value in diff['deleted']:
|
||||
obj.color = (1., 0., 0., .2)
|
||||
elif global_id.string_value in diff['added']:
|
||||
obj.color = (0., 1., 0., .2)
|
||||
elif global_id.string_value in diff['changed']:
|
||||
obj.color = (0., 0., 1., .2)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SelectDiffOldFile(bpy.types.Operator):
|
||||
bl_idname = "bim.select_diff_old_file"
|
||||
bl_label = "Select Diff Old File"
|
||||
|
||||
@@ -1424,6 +1424,7 @@ class BIM_PT_diff(Panel):
|
||||
row = layout.row(align=True)
|
||||
row.prop(bim_properties, "diff_json_file")
|
||||
row.operator("bim.select_diff_json_file", icon="FILE_FOLDER", text="")
|
||||
row.operator("bim.visualise_diff", icon="HIDE_OFF", text="")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(bim_properties, "diff_old_file")
|
||||
|
||||
Reference in New Issue
Block a user