Add ability to select a BCF file to be loaded

This commit is contained in:
Dion Moult
2020-03-20 21:22:32 +11:00
parent a7b52b5578
commit 9932e7f012
4 changed files with 53 additions and 0 deletions
@@ -34,6 +34,8 @@ if bpy is not None:
operator.AssignClass,
operator.SelectClass,
operator.SelectType,
operator.SelectBcfFile,
operator.GetBcfTopics,
operator.SelectFeaturesDir,
operator.SelectDiffJsonFile,
operator.SelectDiffNewFile,
@@ -121,6 +123,7 @@ if bpy is not None:
ui.BIM_PT_documentation,
ui.BIM_PT_bim,
ui.BIM_PT_search,
ui.BIM_PT_bcf,
ui.BIM_PT_owner,
ui.BIM_PT_context,
ui.BIM_PT_qa,
@@ -385,6 +385,18 @@ class RejectElement(bpy.types.Operator):
return {'FINISHED'}
class GetBcfTopics(bpy.types.Operator):
bl_idname = 'bim.get_bcf_topics'
bl_label = 'Get BCF Topics'
def execute(self, context):
import bcfplugin
bcfplugin.openProject(bpy.context.scene.BIMProperties.bcf_file)
topics = bcfplugin.getTopics()
print(topics)
return {'FINISHED'}
class SelectAudited(bpy.types.Operator):
bl_idname = 'bim.select_audited'
bl_label = 'Select Audited'
@@ -821,6 +833,20 @@ class ExecuteIfcDiff(bpy.types.Operator):
return {'FINISHED'}
class SelectBcfFile(bpy.types.Operator):
bl_idname = "bim.select_bcf_file"
bl_label = "Select BCF File"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
bpy.context.scene.BIMProperties.bcf_file = self.filepath
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class SelectFeaturesDir(bpy.types.Operator):
bl_idname = "bim.select_features_dir"
bl_label = "Select Features Directory"
+1
View File
@@ -418,6 +418,7 @@ class BIMProperties(PropertyGroup):
available_contexts: EnumProperty(items=[('Model', 'Model', ''), ('Plan', 'Plan', '')], name="Available Contexts")
available_subcontexts: EnumProperty(items=getSubcontexts, name="Available Subcontexts")
available_target_views: EnumProperty(items=getTargetViews, name="Available Target Views")
bcf_file: StringProperty(default='', name="BCF File")
class MapConversion(PropertyGroup):
+23
View File
@@ -522,6 +522,29 @@ class BIM_PT_search(Panel):
row.operator('bim.colour_by_pset', text='', icon='BRUSH_DATA')
class BIM_PT_bcf(Panel):
bl_label = "BIM Collaboration Format"
bl_idname = "BIM_PT_bcf"
bl_options = {'DEFAULT_CLOSED'}
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
scene = context.scene
props = bpy.context.scene.BIMProperties
row = layout.row(align=True)
row.prop(props, "bcf_file")
row.operator("bim.select_bcf_file", icon="FILE_FOLDER", text="")
row = layout.row()
row.operator("bim.get_bcf_topics")
class BIM_PT_qa(Panel):
bl_label = "BIMTester Quality Auditing"
bl_idname = "BIM_PT_qa"