mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +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.SelectBcfFile,
|
||||||
operator.GetBcfTopics,
|
operator.GetBcfTopics,
|
||||||
operator.ActivateBcfViewpoint,
|
operator.ActivateBcfViewpoint,
|
||||||
|
operator.OpenBcfReferenceLink,
|
||||||
operator.SelectFeaturesDir,
|
operator.SelectFeaturesDir,
|
||||||
operator.SelectDiffJsonFile,
|
operator.SelectDiffJsonFile,
|
||||||
operator.SelectDiffNewFile,
|
operator.SelectDiffNewFile,
|
||||||
@@ -106,6 +107,7 @@ if bpy is not None:
|
|||||||
operator.Uninstall,
|
operator.Uninstall,
|
||||||
prop.BcfTopic,
|
prop.BcfTopic,
|
||||||
prop.BcfTopicLabel,
|
prop.BcfTopicLabel,
|
||||||
|
prop.BcfTopicLink,
|
||||||
prop.Subcontext,
|
prop.Subcontext,
|
||||||
prop.BIMProperties,
|
prop.BIMProperties,
|
||||||
prop.BCFProperties,
|
prop.BCFProperties,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import bpy
|
|||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import webbrowser
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
from . import export_ifc
|
from . import export_ifc
|
||||||
from . import import_ifc
|
from . import import_ifc
|
||||||
@@ -446,6 +447,16 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
|||||||
return {'FINISHED'}
|
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):
|
class SelectAudited(bpy.types.Operator):
|
||||||
bl_idname = 'bim.select_audited'
|
bl_idname = 'bim.select_audited'
|
||||||
bl_label = 'Select Audited'
|
bl_label = 'Select Audited'
|
||||||
|
|||||||
@@ -368,6 +368,10 @@ class BcfTopicLabel(PropertyGroup):
|
|||||||
name: StringProperty(name='Name')
|
name: StringProperty(name='Name')
|
||||||
|
|
||||||
|
|
||||||
|
class BcfTopicLink(PropertyGroup):
|
||||||
|
name: StringProperty(name='Name')
|
||||||
|
|
||||||
|
|
||||||
def refreshBcfTopic(self, context):
|
def refreshBcfTopic(self, context):
|
||||||
global bcfviewpoints_enum
|
global bcfviewpoints_enum
|
||||||
import bcfplugin
|
import bcfplugin
|
||||||
@@ -396,12 +400,19 @@ def refreshBcfTopic(self, context):
|
|||||||
else:
|
else:
|
||||||
props.topic_due_date = ''
|
props.topic_due_date = ''
|
||||||
props.topic_description = topic.description
|
props.topic_description = topic.description
|
||||||
|
|
||||||
while len(props.topic_labels) > 0:
|
while len(props.topic_labels) > 0:
|
||||||
props.topic_labels.remove(0)
|
props.topic_labels.remove(0)
|
||||||
for label in topic.labels:
|
for label in topic.labels:
|
||||||
new = props.topic_labels.add()
|
new = props.topic_labels.add()
|
||||||
new.name = label.value
|
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
|
# Load viewpoints
|
||||||
bcfviewpoints_enum.clear()
|
bcfviewpoints_enum.clear()
|
||||||
viewpoints = bcfplugin.getViewpoints(topic)
|
viewpoints = bcfplugin.getViewpoints(topic)
|
||||||
@@ -508,6 +519,7 @@ class BCFProperties(PropertyGroup):
|
|||||||
topic_due_date: StringProperty(default='', name='Topic Due Date')
|
topic_due_date: StringProperty(default='', name='Topic Due Date')
|
||||||
topic_description: StringProperty(default='', name='Topic Description')
|
topic_description: StringProperty(default='', name='Topic Description')
|
||||||
topic_labels: CollectionProperty(name='BCF Topic Labels', type=BcfTopicLabel)
|
topic_labels: CollectionProperty(name='BCF Topic Labels', type=BcfTopicLabel)
|
||||||
|
topic_links: CollectionProperty(name='BCF Topic Links', type=BcfTopicLink)
|
||||||
|
|
||||||
|
|
||||||
class MapConversion(PropertyGroup):
|
class MapConversion(PropertyGroup):
|
||||||
|
|||||||
@@ -575,8 +575,14 @@ class BIM_PT_bcf(Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(props, 'topic_due_date', text='Due Date')
|
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:")
|
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 = layout.row(align=True)
|
||||||
row.prop(label, 'name', text='')
|
row.prop(label, 'name', text='')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user