Implement delete BCF viewpoint

This commit is contained in:
Dion Moult
2020-12-22 16:22:29 +11:00
parent 2226d5a565
commit ee42703f9f
4 changed files with 44 additions and 13 deletions
@@ -36,6 +36,7 @@ if bpy is not None:
operator.SaveBcfProject,
operator.AddBcfTopic,
operator.ViewBcfTopic,
operator.RemoveBcfViewpoint,
operator.ActivateBcfViewpoint,
operator.OpenUri,
operator.OpenBcfReferenceLink,
@@ -737,6 +737,22 @@ class ViewBcfTopic(bpy.types.Operator):
return {"FINISHED"}
class RemoveBcfViewpoint(bpy.types.Operator):
bl_idname = "bim.remove_bcf_viewpoint"
bl_label = "Remove BCF Viewpoint"
def execute(self, context):
bcfxml = bcfstore.BcfStore.get_bcfxml()
props = bpy.context.scene.BCFProperties
blender_topic = props.topics[props.active_topic_index]
viewpoint_guid = blender_topic.viewpoints
topic = bcfxml.topics[blender_topic.name]
bcfxml.delete_viewpoint(viewpoint_guid, topic)
props.active_topic_index = props.active_topic_index # Refreshes the BCF Topic
print(bcfxml.filepath)
return {"FINISHED"}
class ActivateBcfViewpoint(bpy.types.Operator):
bl_idname = "bim.activate_bcf_viewpoint"
bl_label = "Activate BCF Viewpoint"
@@ -745,7 +761,7 @@ class ActivateBcfViewpoint(bpy.types.Operator):
bcfxml = bcfstore.BcfStore.get_bcfxml()
props = bpy.context.scene.BCFProperties
blender_topic = props.topics[props.active_topic_index]
topic = bcfxml.topics[blender_topic.guid]
topic = bcfxml.topics[blender_topic.name]
if not topic.viewpoints:
return {"FINISHED"}
+10 -5
View File
@@ -1696,6 +1696,7 @@ class BIM_PT_bcf(Panel):
row = layout.row()
row.prop(topic, "viewpoints")
row.operator("bim.activate_bcf_viewpoint", icon="SCENE", text="")
row.operator("bim.remove_bcf_viewpoint", icon="X", text="")
col = layout.column(align=True)
if topic.type:
@@ -1757,8 +1758,8 @@ class BIM_PT_bcf_metadata(Panel):
op = row.operator("bim.open_uri", icon="FILE_FOLDER", text="")
op.uri = os.path.join(bcfxml.filepath, topic.name, f.reference)
box.label(text=f.date)
#box.label(text=f.ifc_project)
#box.label(text=f.ifc_spatial_structure_element)
# box.label(text=f.ifc_project)
# box.label(text=f.ifc_spatial_structure_element)
if topic.reference_links:
layout.label(text="Reference Links:")
@@ -1850,7 +1851,7 @@ class BIM_PT_bcf_comments(Panel):
while words and total_line_chars < props.comment_text_width:
word = words.pop(0)
line_words.append(word)
total_line_chars += len(word) + 1 # 1 is for the space
total_line_chars += len(word) + 1 # 1 is for the space
box.label(text=" ".join(line_words))
box.separator()
@@ -2199,14 +2200,16 @@ class BIM_UL_clash_sets(bpy.types.UIList):
else:
layout.label(text="", translate=False)
class BIM_UL_smart_groups(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
ob = data
if item:
layout.label(text=str(item.number), translate=False, icon='NONE', icon_value=0)
layout.label(text=str(item.number), translate=False, icon="NONE", icon_value=0)
else:
layout.label(text="", translate=False)
class BIM_UL_constraints(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
ob = data
@@ -2469,6 +2472,7 @@ class BIM_PT_qto_utilities(Panel):
row = layout.row(align=True)
row.operator("bim.calculate_object_volumes")
class BIM_PT_clash_manager(Panel):
bl_idname = "BIM_PT_clash_manager"
bl_label = "Clash Manager"
@@ -2503,11 +2507,12 @@ class BIM_PT_clash_manager(Panel):
row = layout.row(align=True)
row.operator("bim.load_smart_groups_for_active_clash_set")
layout.template_list('BIM_UL_smart_groups', '', props, 'smart_clash_groups', props, 'active_smart_group_index')
layout.template_list("BIM_UL_smart_groups", "", props, "smart_clash_groups", props, "active_smart_group_index")
row = layout.row(align=True)
row.operator("bim.select_smart_group")
class BIM_PT_misc_utilities(Panel):
bl_idname = "BIM_PT_misc_utilities"
bl_label = "Miscellaneous"