mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 23:12:34 +00:00
Support BCF topic document references
This commit is contained in:
@@ -39,6 +39,7 @@ if bpy is not None:
|
|||||||
operator.OpenBcfReferenceLink,
|
operator.OpenBcfReferenceLink,
|
||||||
operator.OpenBcfBimSnippetSchema,
|
operator.OpenBcfBimSnippetSchema,
|
||||||
operator.OpenBcfBimSnippetReference,
|
operator.OpenBcfBimSnippetReference,
|
||||||
|
operator.OpenBcfDocumentReference,
|
||||||
operator.SelectFeaturesDir,
|
operator.SelectFeaturesDir,
|
||||||
operator.SelectDiffJsonFile,
|
operator.SelectDiffJsonFile,
|
||||||
operator.SelectDiffNewFile,
|
operator.SelectDiffNewFile,
|
||||||
@@ -111,6 +112,7 @@ if bpy is not None:
|
|||||||
prop.BcfTopic,
|
prop.BcfTopic,
|
||||||
prop.BcfTopicLabel,
|
prop.BcfTopicLabel,
|
||||||
prop.BcfTopicLink,
|
prop.BcfTopicLink,
|
||||||
|
prop.BcfTopicDocumentReference,
|
||||||
prop.Subcontext,
|
prop.Subcontext,
|
||||||
prop.BIMProperties,
|
prop.BIMProperties,
|
||||||
prop.BCFProperties,
|
prop.BCFProperties,
|
||||||
|
|||||||
@@ -484,6 +484,25 @@ class OpenBcfBimSnippetReference(bpy.types.Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
class OpenBcfDocumentReference(bpy.types.Operator):
|
||||||
|
bl_idname = 'bim.open_bcf_document_reference'
|
||||||
|
bl_label = 'Open BCF Document Reference'
|
||||||
|
data: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
import bcfplugin
|
||||||
|
topic_guid, index = self.data.split('/')
|
||||||
|
doc = bpy.context.scene.BCFProperties.topic_document_references[int(index)]
|
||||||
|
uri = doc.name
|
||||||
|
if doc.is_external:
|
||||||
|
webbrowser.open(uri)
|
||||||
|
return {'FINISHED'}
|
||||||
|
webbrowser.open('file:///' + os.path.join(
|
||||||
|
bcfplugin.util.getBcfDir(),
|
||||||
|
topic_guid, uri))
|
||||||
|
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'
|
||||||
|
|||||||
@@ -372,6 +372,13 @@ class BcfTopicLink(PropertyGroup):
|
|||||||
name: StringProperty(name='Name')
|
name: StringProperty(name='Name')
|
||||||
|
|
||||||
|
|
||||||
|
class BcfTopicDocumentReference(PropertyGroup):
|
||||||
|
name: StringProperty(name='Reference')
|
||||||
|
description: StringProperty(name='Description')
|
||||||
|
guid: StringProperty(name='GUID')
|
||||||
|
is_external: BoolProperty(name='Is External')
|
||||||
|
|
||||||
|
|
||||||
def refreshBcfTopic(self, context):
|
def refreshBcfTopic(self, context):
|
||||||
global bcfviewpoints_enum
|
global bcfviewpoints_enum
|
||||||
import bcfplugin
|
import bcfplugin
|
||||||
@@ -427,6 +434,16 @@ def refreshBcfTopic(self, context):
|
|||||||
else:
|
else:
|
||||||
props.topic_snippet_is_external = False
|
props.topic_snippet_is_external = False
|
||||||
|
|
||||||
|
# Load document references
|
||||||
|
while len(props.topic_document_references) > 0:
|
||||||
|
props.topic_document_references.remove(0)
|
||||||
|
for doc in topic.docRefs:
|
||||||
|
new = props.topic_document_references.add()
|
||||||
|
new.name = doc.reference.uri
|
||||||
|
new.description = doc.description
|
||||||
|
new.guid = str(doc.guid)
|
||||||
|
new.is_external = doc.external
|
||||||
|
|
||||||
# Load viewpoints
|
# Load viewpoints
|
||||||
bcfviewpoints_enum.clear()
|
bcfviewpoints_enum.clear()
|
||||||
viewpoints = bcfplugin.getViewpoints(topic)
|
viewpoints = bcfplugin.getViewpoints(topic)
|
||||||
@@ -540,6 +557,7 @@ class BCFProperties(PropertyGroup):
|
|||||||
topic_snippet_schema: StringProperty(name='BIM Snippet Schema')
|
topic_snippet_schema: StringProperty(name='BIM Snippet Schema')
|
||||||
topic_snippet_type: StringProperty(name='BIM Snippet Type')
|
topic_snippet_type: StringProperty(name='BIM Snippet Type')
|
||||||
topic_snippet_is_external: BoolProperty(name='Is BIM Snippet External')
|
topic_snippet_is_external: BoolProperty(name='Is BIM Snippet External')
|
||||||
|
topic_document_references: CollectionProperty(name='BCF Topic Document References', type=BcfTopicDocumentReference)
|
||||||
|
|
||||||
|
|
||||||
class MapConversion(PropertyGroup):
|
class MapConversion(PropertyGroup):
|
||||||
|
|||||||
@@ -600,6 +600,19 @@ class BIM_PT_bcf(Panel):
|
|||||||
else:
|
else:
|
||||||
row.operator('bim.open_bcf_bim_snippet_reference', icon='FILE_FOLDER', text='').topic_guid = props.topic_guid
|
row.operator('bim.open_bcf_bim_snippet_reference', icon='FILE_FOLDER', text='').topic_guid = props.topic_guid
|
||||||
|
|
||||||
|
layout.label(text="Document References:")
|
||||||
|
for index, doc in enumerate(props.topic_document_references):
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(doc, 'description', text=f'File {index+1} Description:')
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(doc, 'name', text=f'File {index+1} URI')
|
||||||
|
if doc.is_external:
|
||||||
|
row.operator('bim.open_bcf_document_reference', icon='URL', text='').data = '{}/{}'.format(
|
||||||
|
props.topic_guid, index)
|
||||||
|
else:
|
||||||
|
row.operator('bim.open_bcf_document_reference', icon='FILE_FOLDER', text='').data = '{}/{}'.format(
|
||||||
|
props.topic_guid, index)
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_qa(Panel):
|
class BIM_PT_qa(Panel):
|
||||||
bl_label = "BIMTester Quality Auditing"
|
bl_label = "BIMTester Quality Auditing"
|
||||||
|
|||||||
Reference in New Issue
Block a user