From f3269b732f3a7a3e7f751e598a987f9615cecfa3 Mon Sep 17 00:00:00 2001 From: Vincent Cadoret Date: Fri, 11 Dec 2020 20:46:07 -0500 Subject: [PATCH] More sensible names for the Smart Clash Groups --- src/ifcblenderexport/blenderbim/bim/operator.py | 4 ++-- src/ifcblenderexport/blenderbim/bim/prop.py | 2 +- src/ifcclash/ifcclash.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index e14d627ea0..05b0e56cc3 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -1963,7 +1963,7 @@ class SmartClashGroup(bpy.types.Operator): else: for smart_group, global_id_pairs in smart_groups[0].items(): new_group = bpy.context.scene.BIMProperties.smart_clash_groups.add() - new_group.number = smart_group + new_group.number = f"{smart_group}" for pair in global_id_pairs: for id in pair: @@ -1997,7 +1997,7 @@ class LoadSmartGroupsForActiveClashSet(bpy.types.Operator): else: for smart_group, global_id_pairs in smart_groups[0].items(): new_group = bpy.context.scene.BIMProperties.smart_clash_groups.add() - new_group.number = int(smart_group) + new_group.number = f"{smart_group}" for pair in global_id_pairs: for id in pair: new_global_id = new_group.global_ids.add() diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 877ba07354..03d6f2850a 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -814,7 +814,7 @@ class PresentationLayer(PropertyGroup): layer_blocked: BoolProperty(name="LayerBlocked", default=False) class SmartClashGroup(PropertyGroup): - number: IntProperty(name="Number") + number: StringProperty(name="Number") global_ids: CollectionProperty(name="GlobalIDs", type=StrProperty) diff --git a/src/ifcclash/ifcclash.py b/src/ifcclash/ifcclash.py index 4b9b3c47e9..449c881481 100644 --- a/src/ifcclash/ifcclash.py +++ b/src/ifcclash/ifcclash.py @@ -334,6 +334,17 @@ class IfcClasher: count_of_smart_groups += len(smart_groups) output_clash_sets[clash_set["name"]].append(smart_groups) + # Rename the clash groups to something more sensible + for clash_set, smart_groups in output_clash_sets.items(): + clash_set_name = clash_set + # Only select the clashes that correspond to the actively selected IFC Clash Set + i = 1 + new_smart_group_name = "" + for smart_group, global_id_pairs in list(smart_groups[0].items()): + new_smart_group_name = f"{clash_set_name} - {i}" + smart_groups[0][new_smart_group_name] = smart_groups[0].pop(smart_group) + i += 1 + count_of_final_clash_sets = len(output_clash_sets) print(f"Took {count_of_input_clashes} clashes in {count_of_clash_sets} clash sets and turned", f"them into {count_of_smart_groups} smart groups in {count_of_final_clash_sets} clash sets")