mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Implement support for adding BCF labels to topics
This commit is contained in:
@@ -37,6 +37,7 @@ if bpy is not None:
|
|||||||
operator.AddBcfTopic,
|
operator.AddBcfTopic,
|
||||||
operator.AddBcfHeaderFile,
|
operator.AddBcfHeaderFile,
|
||||||
operator.AddBcfReferenceLink,
|
operator.AddBcfReferenceLink,
|
||||||
|
operator.AddBcfLabel,
|
||||||
operator.ViewBcfTopic,
|
operator.ViewBcfTopic,
|
||||||
operator.RemoveBcfComment,
|
operator.RemoveBcfComment,
|
||||||
operator.RemoveBcfReferenceLink,
|
operator.RemoveBcfReferenceLink,
|
||||||
|
|||||||
@@ -860,6 +860,25 @@ class AddBcfReferenceLink(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class AddBcfLabel(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.add_bcf_label"
|
||||||
|
bl_label = "Add BCF Label"
|
||||||
|
|
||||||
|
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]
|
||||||
|
if not blender_topic.label:
|
||||||
|
return {"FINISHED"}
|
||||||
|
new = blender_topic.labels.add()
|
||||||
|
new.name = blender_topic.label
|
||||||
|
topic.labels.append(blender_topic.label)
|
||||||
|
bcfxml.edit_topic(topic)
|
||||||
|
blender_topic.label = ""
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class EditBcfReferenceLinks(bpy.types.Operator):
|
class EditBcfReferenceLinks(bpy.types.Operator):
|
||||||
bl_idname = "bim.edit_bcf_reference_links"
|
bl_idname = "bim.edit_bcf_reference_links"
|
||||||
bl_label = "Edit BCF Reference Link"
|
bl_label = "Edit BCF Reference Link"
|
||||||
|
|||||||
@@ -1027,6 +1027,7 @@ class BcfTopic(PropertyGroup):
|
|||||||
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
|
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
|
||||||
reference_link: StringProperty(default="", name="Reference Link")
|
reference_link: StringProperty(default="", name="Reference Link")
|
||||||
labels: CollectionProperty(name="Labels", type=StrProperty)
|
labels: CollectionProperty(name="Labels", type=StrProperty)
|
||||||
|
label: StringProperty(default="", name="Label")
|
||||||
bim_snippet: PointerProperty(type=BcfBimSnippet)
|
bim_snippet: PointerProperty(type=BcfBimSnippet)
|
||||||
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)
|
document_references: CollectionProperty(name="Document References", type=BcfDocumentReference)
|
||||||
related_topics: CollectionProperty(name="Related Topics", type=StrProperty)
|
related_topics: CollectionProperty(name="Related Topics", type=StrProperty)
|
||||||
|
|||||||
@@ -1748,30 +1748,32 @@ class BIM_PT_bcf_metadata(Panel):
|
|||||||
bcf_topic = bcfxml.topics[topic.name]
|
bcf_topic = bcfxml.topics[topic.name]
|
||||||
|
|
||||||
layout.label(text="Header Files:")
|
layout.label(text="Header Files:")
|
||||||
for index, f in enumerate(bcf_topic.header.files):
|
|
||||||
box = self.layout.box()
|
|
||||||
row = box.row(align=True)
|
|
||||||
row.label(text=f.filename, icon="FILE_BLANK")
|
|
||||||
if f.is_external:
|
|
||||||
row.operator("bim.open_uri", icon="URL", text="").uri = f.reference
|
|
||||||
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
|
|
||||||
|
|
||||||
row = box.row()
|
if bcf_topic.header:
|
||||||
row.label(text="Date")
|
for index, f in enumerate(bcf_topic.header.files):
|
||||||
row.label(text=f.date)
|
box = self.layout.box()
|
||||||
|
row = box.row(align=True)
|
||||||
|
row.label(text=f.filename, icon="FILE_BLANK")
|
||||||
|
if f.is_external:
|
||||||
|
row.operator("bim.open_uri", icon="URL", text="").uri = f.reference
|
||||||
|
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
|
||||||
|
|
||||||
if f.ifc_project:
|
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.label(text="IFC Project")
|
row.label(text="Date")
|
||||||
row.label(text=f.ifc_project)
|
row.label(text=f.date)
|
||||||
|
|
||||||
if f.ifc_spatial_structure_element:
|
if f.ifc_project:
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.label(text="IFC Spatial Structure Element")
|
row.label(text="IFC Project")
|
||||||
row.label(text=f.ifc_spatial_structure_element)
|
row.label(text=f.ifc_project)
|
||||||
|
|
||||||
|
if f.ifc_spatial_structure_element:
|
||||||
|
row = box.row()
|
||||||
|
row.label(text="IFC Spatial Structure Element")
|
||||||
|
row.label(text=f.ifc_spatial_structure_element)
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(topic, "file_reference")
|
row.prop(topic, "file_reference")
|
||||||
@@ -1800,6 +1802,10 @@ class BIM_PT_bcf_metadata(Panel):
|
|||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(label, "name", text="")
|
row.prop(label, "name", text="")
|
||||||
row.operator("bim.remove_bcf_label", icon="X", text="").index = index
|
row.operator("bim.remove_bcf_label", icon="X", text="").index = index
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(topic, "label")
|
||||||
|
row = layout.row()
|
||||||
|
row.operator("bim.add_bcf_label")
|
||||||
|
|
||||||
if topic.bim_snippet.schema:
|
if topic.bim_snippet.schema:
|
||||||
layout.label(text="BIM Snippet:")
|
layout.label(text="BIM Snippet:")
|
||||||
|
|||||||
Reference in New Issue
Block a user