Eyedrop tool to visually select objects to export to IFC

This commit is contained in:
Dion Moult
2020-04-27 08:32:01 +10:00
parent d65f2b432b
commit 9f5ef32173
3 changed files with 17 additions and 1 deletions
@@ -107,6 +107,7 @@ if bpy is not None:
operator.RemoveCsvAttribute,
operator.ExportIfcCsv,
operator.ImportIfcCsv,
operator.EyedropIfcCsv,
prop.StrProperty,
prop.Classification,
prop.ClassificationReference,
@@ -2076,3 +2076,17 @@ class ImportIfcCsv(bpy.types.Operator):
ifc_csv.output = self.filepath
ifc_csv.Import(bpy.context.scene.BIMProperties.ifc_file)
return {'FINISHED'}
class EyedropIfcCsv(bpy.types.Operator):
bl_idname = 'bim.eyedrop_ifccsv'
bl_label = 'Query Selected Items'
def execute(self, context):
global_ids = []
for obj in bpy.context.selected_objects:
if hasattr(obj, 'BIMObjectProperties') \
and obj.BIMObjectProperties.attributes.get('GlobalId'):
global_ids.append('#' + obj.BIMObjectProperties.attributes.get('GlobalId').string_value)
bpy.context.scene.BIMProperties.ifc_selector = '|'.join(global_ids)
return {'FINISHED'}
+2 -1
View File
@@ -662,8 +662,9 @@ class BIM_PT_ifccsv(Panel):
scene = context.scene
props = scene.BIMProperties
row = layout.row()
row = layout.row(align=True)
row.prop(props, 'ifc_selector')
row.operator('bim.eyedrop_ifccsv', icon='EYEDROPPER', text='')
row = layout.row()
row.operator('bim.add_csv_attribute')