Implement BCF related topics

This commit is contained in:
Dion Moult
2020-03-25 17:55:52 +11:00
parent 1971bfe014
commit 3a590e4ba1
4 changed files with 34 additions and 1 deletions
@@ -35,6 +35,7 @@ if bpy is not None:
operator.SelectType,
operator.SelectBcfFile,
operator.GetBcfTopics,
operator.ViewBcfTopic,
operator.ActivateBcfViewpoint,
operator.OpenBcfReferenceLink,
operator.OpenBcfBimSnippetSchema,
@@ -113,6 +114,7 @@ if bpy is not None:
prop.BcfTopicLabel,
prop.BcfTopicLink,
prop.BcfTopicDocumentReference,
prop.BcfTopicRelatedTopic,
prop.Subcontext,
prop.BIMProperties,
prop.BCFProperties,
+13 -1
View File
@@ -404,6 +404,18 @@ class GetBcfTopics(bpy.types.Operator):
return {'FINISHED'}
class ViewBcfTopic(bpy.types.Operator):
bl_idname = 'bim.view_bcf_topic'
bl_label = 'Get BCF Topic'
topic_guid: bpy.props.StringProperty()
def execute(self, context):
for index, topic in enumerate(bcf.BcfStore.topics):
if str(topic[1].xmlId) == self.topic_guid:
bpy.context.scene.BCFProperties.active_topic_index = index
return {'FINISHED'}
class ActivateBcfViewpoint(bpy.types.Operator):
bl_idname = 'bim.activate_bcf_viewpoint'
bl_label = 'Activate BCF Viewpoint'
@@ -411,7 +423,7 @@ class ActivateBcfViewpoint(bpy.types.Operator):
def execute(self, context):
import bcfplugin
topics = bcfplugin.getTopics()
topics = bcf.BcfStore.topics
if not topics:
return {'FINISHED'}
topic = topics[bpy.context.scene.BCFProperties.active_topic_index][1]
+14
View File
@@ -379,6 +379,11 @@ class BcfTopicDocumentReference(PropertyGroup):
is_external: BoolProperty(name='Is External')
class BcfTopicRelatedTopic(PropertyGroup):
name: StringProperty(name='Name')
guid: StringProperty(name='GUID')
def refreshBcfTopic(self, context):
global bcfviewpoints_enum
import bcfplugin
@@ -444,6 +449,14 @@ def refreshBcfTopic(self, context):
new.guid = str(doc.guid)
new.is_external = doc.external
# Load related topics
while len(props.topic_related_topics) > 0:
props.topic_related_topics.remove(0)
for t in topic.relatedTopics:
new = props.topic_related_topics.add()
new.name = bcfplugin.getTopicFromUUID(t.value).title
new.guid = str(t.value)
# Load viewpoints
bcfviewpoints_enum.clear()
viewpoints = bcfplugin.getViewpoints(topic)
@@ -558,6 +571,7 @@ class BCFProperties(PropertyGroup):
topic_snippet_type: StringProperty(name='BIM Snippet Type')
topic_snippet_is_external: BoolProperty(name='Is BIM Snippet External')
topic_document_references: CollectionProperty(name='BCF Topic Document References', type=BcfTopicDocumentReference)
topic_related_topics: CollectionProperty(name='BCF Topic Related Topics', type=BcfTopicRelatedTopic)
class MapConversion(PropertyGroup):
+5
View File
@@ -613,6 +613,11 @@ class BIM_PT_bcf(Panel):
row.operator('bim.open_bcf_document_reference', icon='FILE_FOLDER', text='').data = '{}/{}'.format(
props.topic_guid, index)
layout.label(text="Related Topics:")
for topic in props.topic_related_topics:
row = layout.row(align=True)
row.operator('bim.view_bcf_topic', text=topic.name).topic_guid = topic.guid
class BIM_PT_qa(Panel):
bl_label = "BIMTester Quality Auditing"