mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Implement adding BCF reference links
This commit is contained in:
@@ -36,6 +36,7 @@ if bpy is not None:
|
|||||||
operator.SaveBcfProject,
|
operator.SaveBcfProject,
|
||||||
operator.AddBcfTopic,
|
operator.AddBcfTopic,
|
||||||
operator.AddBcfHeaderFile,
|
operator.AddBcfHeaderFile,
|
||||||
|
operator.AddBcfReferenceLink,
|
||||||
operator.ViewBcfTopic,
|
operator.ViewBcfTopic,
|
||||||
operator.RemoveBcfComment,
|
operator.RemoveBcfComment,
|
||||||
operator.RemoveBcfReferenceLink,
|
operator.RemoveBcfReferenceLink,
|
||||||
|
|||||||
@@ -841,6 +841,25 @@ class RemoveBcfFile(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class AddBcfReferenceLink(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.add_bcf_reference_link"
|
||||||
|
bl_label = "Add BCF Reference Link"
|
||||||
|
|
||||||
|
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.reference_link:
|
||||||
|
return {"FINISHED"}
|
||||||
|
new = blender_topic.reference_links.add()
|
||||||
|
new.name = blender_topic.reference_link
|
||||||
|
topic.reference_links.append(blender_topic.reference_link)
|
||||||
|
bcfxml.edit_topic(topic)
|
||||||
|
blender_topic.reference_link = ""
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class RemoveBcfReferenceLink(bpy.types.Operator):
|
class RemoveBcfReferenceLink(bpy.types.Operator):
|
||||||
bl_idname = "bim.remove_bcf_reference_link"
|
bl_idname = "bim.remove_bcf_reference_link"
|
||||||
bl_label = "Remove BCF Reference Link"
|
bl_label = "Remove BCF Reference Link"
|
||||||
@@ -854,7 +873,6 @@ class RemoveBcfReferenceLink(bpy.types.Operator):
|
|||||||
del topic.reference_links[self.index]
|
del topic.reference_links[self.index]
|
||||||
bcfxml.edit_topic(topic)
|
bcfxml.edit_topic(topic)
|
||||||
blender_topic.reference_links.remove(self.index)
|
blender_topic.reference_links.remove(self.index)
|
||||||
props.active_topic_index = props.active_topic_index # Refreshes the BCF Topic
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1017,6 +1017,7 @@ class BcfTopic(PropertyGroup):
|
|||||||
file_ifc_project: StringProperty(default="", name="IFC Project")
|
file_ifc_project: StringProperty(default="", name="IFC Project")
|
||||||
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
|
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
|
||||||
reference_links: CollectionProperty(name="Reference Links", type=StrProperty)
|
reference_links: CollectionProperty(name="Reference Links", type=StrProperty)
|
||||||
|
reference_link: StringProperty(default="", name="Reference Link")
|
||||||
labels: CollectionProperty(name="Labels", type=StrProperty)
|
labels: CollectionProperty(name="Labels", type=StrProperty)
|
||||||
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)
|
||||||
|
|||||||
@@ -1747,32 +1747,31 @@ class BIM_PT_bcf_metadata(Panel):
|
|||||||
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
||||||
bcf_topic = bcfxml.topics[topic.name]
|
bcf_topic = bcfxml.topics[topic.name]
|
||||||
|
|
||||||
if bcf_topic.header and bcf_topic.header.files:
|
layout.label(text="Header Files:")
|
||||||
layout.label(text="Header Files:")
|
for index, f in enumerate(bcf_topic.header.files):
|
||||||
for index, f in enumerate(bcf_topic.header.files):
|
box = self.layout.box()
|
||||||
box = self.layout.box()
|
row = box.row(align=True)
|
||||||
row = box.row(align=True)
|
row.label(text=f.filename, icon="FILE_BLANK")
|
||||||
row.label(text=f.filename, icon="FILE_BLANK")
|
if f.is_external:
|
||||||
if f.is_external:
|
row.operator("bim.open_uri", icon="URL", text="").uri = f.reference
|
||||||
row.operator("bim.open_uri", icon="URL", text="").uri = f.reference
|
else:
|
||||||
else:
|
op = row.operator("bim.open_uri", icon="FILE_FOLDER", text="")
|
||||||
op = row.operator("bim.open_uri", icon="FILE_FOLDER", text="")
|
op.uri = os.path.join(bcfxml.filepath, topic.name, f.reference)
|
||||||
op.uri = os.path.join(bcfxml.filepath, topic.name, f.reference)
|
row.operator("bim.remove_bcf_file", icon="X", text="").index = index
|
||||||
row.operator("bim.remove_bcf_file", icon="X", text="").index = index
|
|
||||||
|
|
||||||
|
row = box.row()
|
||||||
|
row.label(text="Date")
|
||||||
|
row.label(text=f.date)
|
||||||
|
|
||||||
|
if f.ifc_project:
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.label(text="Date")
|
row.label(text="IFC Project")
|
||||||
row.label(text=f.date)
|
row.label(text=f.ifc_project)
|
||||||
|
|
||||||
if f.ifc_project:
|
if f.ifc_spatial_structure_element:
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.label(text="IFC Project")
|
row.label(text="IFC Spatial Structure Element")
|
||||||
row.label(text=f.ifc_project)
|
row.label(text=f.ifc_spatial_structure_element)
|
||||||
|
|
||||||
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")
|
||||||
@@ -1785,13 +1784,16 @@ class BIM_PT_bcf_metadata(Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator("bim.add_bcf_header_file")
|
row.operator("bim.add_bcf_header_file")
|
||||||
|
|
||||||
if topic.reference_links:
|
layout.label(text="Reference Links:")
|
||||||
layout.label(text="Reference Links:")
|
for index, link in enumerate(topic.reference_links):
|
||||||
for index, link in enumerate(topic.reference_links):
|
row = layout.row(align=True)
|
||||||
row = layout.row(align=True)
|
row.prop(link, "name")
|
||||||
row.prop(link, "name")
|
row.operator("bim.open_uri", icon="URL", text="").uri = link.name
|
||||||
row.operator("bim.open_uri", icon="URL", text="").uri = link.name
|
row.operator("bim.remove_bcf_reference_link", icon="X", text="").index = index
|
||||||
row.operator("bim.remove_bcf_reference_link", icon="X", text="").index = index
|
row = layout.row()
|
||||||
|
row.prop(topic, "reference_link")
|
||||||
|
row = layout.row()
|
||||||
|
row.operator("bim.add_bcf_reference_link")
|
||||||
|
|
||||||
if topic.labels:
|
if topic.labels:
|
||||||
layout.label(text="Labels:")
|
layout.label(text="Labels:")
|
||||||
|
|||||||
Reference in New Issue
Block a user