Implement support for deleting BCF header files

This commit is contained in:
Dion Moult
2020-12-23 16:22:29 +11:00
parent 7b2fa3e877
commit 67f7e68fa7
4 changed files with 28 additions and 2 deletions
@@ -42,6 +42,7 @@ if bpy is not None:
operator.ActivateBcfViewpoint,
operator.AddBcfViewpoint,
operator.RemoveBcfViewpoint,
operator.RemoveBcfFile,
operator.OpenUri,
operator.OpenBcfReferenceLink,
operator.SelectFeaturesDir,
@@ -803,6 +803,21 @@ class RemoveBcfViewpoint(bpy.types.Operator):
return {"FINISHED"}
class RemoveBcfFile(bpy.types.Operator):
bl_idname = "bim.remove_bcf_file"
bl_label = "Remove BCF File"
index: bpy.props.IntProperty()
def execute(self, context):
bcfxml = bcfstore.BcfStore.get_bcfxml()
props = bpy.context.scene.BCFProperties
blender_topic = props.topics[props.active_topic_index]
topic = bcfxml.topics[blender_topic.name]
bcfxml.delete_file(topic, self.index)
props.active_topic_index = props.active_topic_index # Refreshes the BCF Topic
return {"FINISHED"}
class RemoveBcfComment(bpy.types.Operator):
bl_idname = "bim.remove_bcf_comment"
bl_label = "Remove BCF Comment"
+2 -1
View File
@@ -1747,7 +1747,7 @@ class BIM_PT_bcf_metadata(Panel):
bcfxml = bcfstore.BcfStore.get_bcfxml()
bcf_topic = bcfxml.topics[topic.name]
if bcf_topic.header:
if bcf_topic.header and bcf_topic.header.files:
layout.label(text="Header Files:")
for index, f in enumerate(bcf_topic.header.files):
box = self.layout.box()
@@ -1758,6 +1758,7 @@ class BIM_PT_bcf_metadata(Panel):
else:
op = row.operator("bim.open_uri", icon="FILE_FOLDER", text="")
op.uri = os.path.join(bcfxml.filepath, topic.name, f.reference)
row.operator("bim.remove_bcf_file", icon="X", text="").index = index
box.label(text=f.date)
# box.label(text=f.ifc_project)
# box.label(text=f.ifc_spatial_structure_element)