New feature to unassign/reassign IFC class easily

This commit is contained in:
Dion Moult
2020-06-23 23:42:33 +10:00
parent da7ba7b1e9
commit 3e9fff6c19
3 changed files with 42 additions and 14 deletions
@@ -174,7 +174,7 @@ class AssignClass(bpy.types.Operator):
for obj in objects:
existing_class = None
if '/' in obj.name \
and obj.name[0:3] == 'Ifc':
and obj.name[0:3] == 'Ifc':
existing_class = obj.name.split('/')[0]
if existing_class:
obj.name = '{}/{}'.format(
@@ -200,6 +200,25 @@ class AssignClass(bpy.types.Operator):
object_type.string_value = bpy.context.scene.BIMProperties.ifc_userdefined_type
return {'FINISHED'}
class UnassignClass(bpy.types.Operator):
bl_idname = 'bim.unassign_class'
bl_label = 'Unassign IFC Class'
object_name: bpy.props.StringProperty()
def execute(self, context):
if self.object_name:
objects = [bpy.data.objects.get(self.object_name)]
else:
objects = bpy.context.selected_objects
for obj in objects:
existing_class = None
if '/' in obj.name \
and obj.name[0:3] == 'Ifc':
obj.name = '/'.join(obj.name.split('/')[1:])
return {'FINISHED'}
class SelectClass(bpy.types.Operator):
bl_idname = 'bim.select_class'
bl_label = 'Select IFC Class'