New feature to select similar type

This commit is contained in:
Dion Moult
2020-04-29 20:26:36 +10:00
parent a34a05262e
commit adb4a3f72a
3 changed files with 20 additions and 1 deletions
@@ -109,6 +109,7 @@ if bpy is not None:
operator.ImportIfcCsv,
operator.EyedropIfcCsv,
operator.ReloadIfcFile,
operator.SelectSimilarType,
prop.StrProperty,
prop.Classification,
prop.ClassificationReference,
@@ -2212,3 +2212,20 @@ class ReloadIfcFile(bpy.types.Operator):
context, bpy.context.scene.BIMProperties.ifc_file, logger)
ifc_importer = import_ifc.IfcImporter(ifc_import_settings)
ifc_importer.execute()
class SelectSimilarType(bpy.types.Operator):
bl_idname = 'bim.select_similar_type'
bl_label = 'Select Similar Type'
def execute(self, context):
if context.active_object.BIMObjectProperties.relating_type:
relating_type = context.active_object.BIMObjectProperties.relating_type
elif 'Type/' in context.active_object.name:
relating_type = context.active_object
else:
return {'FINISHED'}
for obj in bpy.context.visible_objects:
if obj.BIMObjectProperties.relating_type == relating_type:
obj.select_set(True)
return {'FINISHED'}
+2 -1
View File
@@ -41,8 +41,9 @@ class BIM_PT_object(Panel):
row = layout.row()
row.prop(props, 'attributes')
row = layout.row()
row = layout.row(align=True)
row.prop(props, 'relating_type')
row.operator('bim.select_similar_type', icon='RESTRICT_SELECT_OFF', text='')
row = layout.row()
row.prop(props, 'relating_structure')