Post #680: ; bpy.ops.mesh.separate(type='SELECTED'); bpy.ops.object.mode_set(mode='OBJECT'); bpy.ops.object.select_all(action='DESELECT'); C.scene.objects.active = D.objects[new_name]; D.objects[new_name].select = True; bpy.ops.object.mode_set(mode='EDIT')
Leafar:
And now I realize that the perfect script is duplicating first the selection of the faces, verts or edges.
DonΒ΄t you think?
Yes, both tools can be useful. Use this code instead:
from .bl_utils import uname; new_name = uname(D.objects, C.active_object.name); bpy.ops.mesh.duplicate(); bpy.ops.mesh.separate(type='SELECTED'); bpy.ops.object.mode_set(mode='OBJECT'); bpy.ops.object.select_all(action='DESELECT'); C.scene.objects.active = D.objects[new_name]; D.objects[new_name].select = True; bpy.ops.object.mode_set(mode='EDIT')