I want to fill out the selection I have. So from the active face I want to select more a lot and deselect the normal selection after every iteration. How often it should use the select more command is not important, since my selection that I give should stop the select more command from selecting to much.
So the script should do this:
- From my selection it selects only the active face
- Selects More command
- Deselects my selection I started with except the active face
- Repeat 2. to 3. for x times
I could not do it. I tried it with bmesh but I don't understand how it works.
Here is my code so far:
import bpy
growAmount = 30
obj = bpy.context.active_object
if bpy.context.object.mode == 'EDIT':
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.mode_set(mode = 'EDIT')
selectedFaces = []
activeFace = obj.data.polygons[obj.data.polygons.active]
for i in obj.data.polygons:
if i.select:
if i.index != activeFace.index:
selectedFaces.append(i.index)
bpy.ops.object.mode_set(mode = 'OBJECT')
for i in selectedFaces:
obj.data.polygons[i].select = False
for i in range(growAmount):
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_more(use_face_step=False)
bpy.ops.object.mode_set(mode = 'OBJECT')
for i in selectedFaces:
obj.data.polygons[i].select = False
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.mode_set(mode = 'EDIT')
It works okay but leaves edges selected that I don't want.