mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Show topic reference links and allow browsing of links
This commit is contained in:
@@ -36,6 +36,7 @@ if bpy is not None:
|
||||
operator.SelectBcfFile,
|
||||
operator.GetBcfTopics,
|
||||
operator.ActivateBcfViewpoint,
|
||||
operator.OpenBcfReferenceLink,
|
||||
operator.SelectFeaturesDir,
|
||||
operator.SelectDiffJsonFile,
|
||||
operator.SelectDiffNewFile,
|
||||
@@ -106,6 +107,7 @@ if bpy is not None:
|
||||
operator.Uninstall,
|
||||
prop.BcfTopic,
|
||||
prop.BcfTopicLabel,
|
||||
prop.BcfTopicLink,
|
||||
prop.Subcontext,
|
||||
prop.BIMProperties,
|
||||
prop.BCFProperties,
|
||||
|
||||
@@ -3,6 +3,7 @@ import bpy
|
||||
import time
|
||||
import json
|
||||
import logging
|
||||
import webbrowser
|
||||
import ifcopenshell
|
||||
from . import export_ifc
|
||||
from . import import_ifc
|
||||
@@ -446,6 +447,16 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class OpenBcfReferenceLink(bpy.types.Operator):
|
||||
bl_idname = 'bim.open_bcf_reference_link'
|
||||
bl_label = 'Open BCF Reference Link'
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
webbrowser.open(bpy.context.scene.BCFProperties.topic_links[self.index].name)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SelectAudited(bpy.types.Operator):
|
||||
bl_idname = 'bim.select_audited'
|
||||
bl_label = 'Select Audited'
|
||||
|
||||
@@ -368,6 +368,10 @@ class BcfTopicLabel(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
|
||||
|
||||
class BcfTopicLink(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
|
||||
|
||||
def refreshBcfTopic(self, context):
|
||||
global bcfviewpoints_enum
|
||||
import bcfplugin
|
||||
@@ -396,12 +400,19 @@ def refreshBcfTopic(self, context):
|
||||
else:
|
||||
props.topic_due_date = ''
|
||||
props.topic_description = topic.description
|
||||
|
||||
while len(props.topic_labels) > 0:
|
||||
props.topic_labels.remove(0)
|
||||
for label in topic.labels:
|
||||
new = props.topic_labels.add()
|
||||
new.name = label.value
|
||||
|
||||
while len(props.topic_links) > 0:
|
||||
props.topic_links.remove(0)
|
||||
for link in topic.referenceLinks:
|
||||
new = props.topic_links.add()
|
||||
new.name = link.value
|
||||
|
||||
# Load viewpoints
|
||||
bcfviewpoints_enum.clear()
|
||||
viewpoints = bcfplugin.getViewpoints(topic)
|
||||
@@ -508,6 +519,7 @@ class BCFProperties(PropertyGroup):
|
||||
topic_due_date: StringProperty(default='', name='Topic Due Date')
|
||||
topic_description: StringProperty(default='', name='Topic Description')
|
||||
topic_labels: CollectionProperty(name='BCF Topic Labels', type=BcfTopicLabel)
|
||||
topic_links: CollectionProperty(name='BCF Topic Links', type=BcfTopicLink)
|
||||
|
||||
|
||||
class MapConversion(PropertyGroup):
|
||||
|
||||
@@ -575,8 +575,14 @@ class BIM_PT_bcf(Panel):
|
||||
row = layout.row()
|
||||
row.prop(props, 'topic_due_date', text='Due Date')
|
||||
|
||||
layout.label(text="Reference Links:")
|
||||
for index, label in enumerate(props.topic_links):
|
||||
row = layout.row(align=True)
|
||||
row.prop(label, 'name', text='')
|
||||
row.operator('bim.open_bcf_reference_link', icon='URL', text='').index = index
|
||||
|
||||
layout.label(text="Labels:")
|
||||
for i, label in enumerate(props.topic_labels):
|
||||
for index, label in enumerate(props.topic_labels):
|
||||
row = layout.row(align=True)
|
||||
row.prop(label, 'name', text='')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user