mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Add support for viewing BCF comments
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class BcfStore():
|
||||
topics = []
|
||||
comments = []
|
||||
|
||||
@@ -9,6 +9,7 @@ from . import import_ifc
|
||||
from . import cut_ifc
|
||||
from . import sheeter
|
||||
from . import schema
|
||||
from . import bcf
|
||||
from bpy_extras.io_utils import ImportHelper
|
||||
from itertools import cycle
|
||||
from mathutils import Vector, Matrix
|
||||
@@ -393,10 +394,10 @@ class GetBcfTopics(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
import bcfplugin
|
||||
bcfplugin.openProject(bpy.context.scene.BIMProperties.bcf_file)
|
||||
topics = bcfplugin.getTopics()
|
||||
bcf.BcfStore.topics = bcfplugin.getTopics()
|
||||
while len(bpy.context.scene.BIMProperties.bcf_topics) > 0:
|
||||
bpy.context.scene.BIMProperties.bcf_topics.remove(0)
|
||||
for topic in topics:
|
||||
for topic in bcf.BcfStore.topics:
|
||||
new = bpy.context.scene.BIMProperties.bcf_topics.add()
|
||||
new.name = topic[0]
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -4,6 +4,7 @@ import csv
|
||||
from pathlib import Path
|
||||
from . import export_ifc
|
||||
from . import schema
|
||||
from . import bcf
|
||||
import bpy
|
||||
from bpy.types import PropertyGroup
|
||||
from bpy.app.handlers import persistent
|
||||
@@ -363,21 +364,30 @@ class BcfTopic(PropertyGroup):
|
||||
name: StringProperty(name='Name')
|
||||
|
||||
|
||||
def refreshBcfViewpoints(self, context):
|
||||
def refreshBcfTopic(self, context):
|
||||
global bcfviewpoints_enum
|
||||
import bcfplugin
|
||||
|
||||
bcfviewpoints_enum.clear()
|
||||
topics = bcfplugin.getTopics()
|
||||
if not topics:
|
||||
return bcfviewpoints_enum
|
||||
topic = topics[bpy.context.scene.BIMProperties.active_bcf_topic_index][1]
|
||||
topic = bcf.BcfStore.topics[bpy.context.scene.BIMProperties.active_bcf_topic_index][1]
|
||||
viewpoints = bcfplugin.getViewpoints(topic)
|
||||
if not viewpoints:
|
||||
return bcfviewpoints_enum
|
||||
for i, viewpoint in enumerate(viewpoints):
|
||||
bcfviewpoints_enum.append((str(i), 'View {}'.format(i+1), ''))
|
||||
|
||||
bcf.BcfStore.comments = bcfplugin.getComments(topic)
|
||||
comments = bpy.data.texts.get('BCF Comments')
|
||||
if comments:
|
||||
comments.clear()
|
||||
else:
|
||||
comments = bpy.data.texts.new('BCF Comments')
|
||||
for i, comment in enumerate(bcf.BcfStore.comments):
|
||||
comments.write('# Comment {} - {}\n'.format(i + 1, comment[1].xmlId))
|
||||
comments.write('# From: {} on {}\n'.format(comment[1].author, comment[1].date))
|
||||
if comment[1].modDate:
|
||||
comments.write('# Modified by {} on {}\n'.format(comment[1].modAuthor, comment[1].modDate))
|
||||
comments.write(comment[1].comment)
|
||||
comments.write('\n\n-----\n\n')
|
||||
|
||||
|
||||
def getBcfViewpoints(self, context):
|
||||
global bcfviewpoints_enum
|
||||
@@ -446,7 +456,7 @@ class BIMProperties(PropertyGroup):
|
||||
available_target_views: EnumProperty(items=getTargetViews, name="Available Target Views")
|
||||
bcf_file: StringProperty(default='', name='BCF File')
|
||||
bcf_topics: CollectionProperty(name='BCF Topics', type=BcfTopic)
|
||||
active_bcf_topic_index: IntProperty(name='Active BCF Topic Index', update=refreshBcfViewpoints)
|
||||
active_bcf_topic_index: IntProperty(name='Active BCF Topic Index', update=refreshBcfTopic)
|
||||
bcf_viewpoints: EnumProperty(items=getBcfViewpoints, name='BCF Viewpoints')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user