Add new feature to select object by GlobalId

This commit is contained in:
Dion Moult
2019-10-19 17:38:25 +11:00
parent 9ee708fbe6
commit 2751b7728f
3 changed files with 29 additions and 0 deletions
@@ -39,12 +39,16 @@ classes = (
operator.AddAttribute,
operator.RemoveAttribute,
operator.QuickProjectSetup,
operator.SelectGlobalId,
ui.BIMProperties,
ui.MapConversion,
ui.TargetCRS,
ui.Attribute,
ui.Pset,
ui.ObjectProperties,
ui.MaterialProperties,
ui.MeshProperties,
ui.GISPanel,
ui.BIMPanel,
ui.MVDPanel,
ui.MaterialPanel,
@@ -66,6 +70,8 @@ def register():
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=ui.BIMProperties)
bpy.types.Scene.MapConversion = bpy.props.PointerProperty(type=ui.MapConversion)
bpy.types.Scene.TargetCRS = bpy.props.PointerProperty(type=ui.TargetCRS)
bpy.types.Object.ObjectProperties = bpy.props.PointerProperty(type=ui.ObjectProperties)
bpy.types.Collection.ObjectProperties = bpy.props.PointerProperty(type=ui.ObjectProperties)
bpy.types.Material.MaterialProperties = bpy.props.PointerProperty(type=ui.MaterialProperties)
@@ -77,6 +83,8 @@ def unregister():
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
del(bpy.types.Scene.BIMProperties)
del(bpy.types.Scene.MapConversion)
del(bpy.types.Scene.TargetCRS)
del(bpy.types.Object.ObjectProperties)
del(bpy.types.Collection.ObjectProperties)
del(bpy.types.Material.MaterialProperties)
@@ -61,6 +61,19 @@ class ImportIFC(bpy.types.Operator, ImportHelper):
ifc_import_settings.logger.info('Import finished in {:.2f} seconds'.format(time.time() - start))
return {'FINISHED'}
class SelectGlobalId(bpy.types.Operator):
bl_idname = 'bim.select_global_id'
bl_label = 'Select GlobalId'
def execute(self, context):
for object in bpy.context.visible_objects:
index = object.ObjectProperties.attributes.find('GlobalId')
if index != -1 \
and object.ObjectProperties.attributes[index].string_value == bpy.context.scene.BIMProperties.global_id:
object.select_set(True)
break
return {'FINISHED'}
class AssignClass(bpy.types.Operator):
bl_idname = 'bim.assign_class'
bl_label = 'Assign IFC Class'
+8
View File
@@ -47,6 +47,7 @@ class BIMProperties(bpy.types.PropertyGroup):
pset_name: bpy.props.EnumProperty(items=getPsetNames, name="Pset Name")
pset_file: bpy.props.EnumProperty(items=getPsetFiles, name="Pset File")
has_georeferencing: bpy.props.BoolProperty(name="Has Georeferencing", default=False)
global_id: bpy.props.StringProperty(name="GlobalId")
class MapConversion(bpy.types.PropertyGroup):
eastings: bpy.props.StringProperty(name="Eastings")
@@ -241,6 +242,13 @@ class BIMPanel(bpy.types.Panel):
row.prop(bim_properties, "data_dir")
row.operator("bim.select_data_dir", icon="FILE_FOLDER", text="")
layout.label(text="Software Identity:")
row = layout.row()
row.prop(bim_properties, 'global_id')
row = layout.row()
row.operator('bim.select_global_id')
layout.label(text="IFC Categorisation:")
row = layout.row()