I run into this issue when writing Python scripts. When I am selecting several individual verts and I make an extrusion, I get some odd behavior I cannot explain. It doesn't happen if I am working with edges or faces. For example, I open a fresh instance of Blender, select the default cube, go into edit more, deselect all, and run
import bpy, bmesh
# have cube as active object, in edit mode, no verts selected
mesh = bmesh.from_edit_mesh(bpy.context.object.data)
for v in mesh.verts:
if v.co[2] > 0.0:
v.select = True
bpy.ops.mesh.extrude_region_move(
MESH_OT_extrude_region={"use_normal_flip":False, "mirror":False},
TRANSFORM_OT_translate={"value":(0.0, 0.0, 2.0),
"orient_type":'GLOBAL',
"orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)),
"orient_matrix_type":'GLOBAL',
"constraint_axis":(False, False, False),
"mirror":False,
"use_proportional_edit":False,
"proportional_edit_falloff":'SMOOTH',
"proportional_size":1,
"use_proportional_connected":False,
"use_proportional_projected":False,
"snap":False,
"snap_target":'CLOSEST',
"snap_point":(0, 0, 0),
"snap_align":False,
"snap_normal":(0, 0, 0),
"gpencil_strokes":False,
"cursor_transform":False,
"texture_space":False,
"remove_on_cancel":False,
"release_confirm":False,
"use_accurate":False})
I get this where the verts are extruded but they are just lines, not connected to each other, as if I had went around and extruded each vert individually.
I don't generally want that though. I found this odd little "hack" to get around the issue. I get the verts selected as desired, and then toggle out and back into edit mode before doing the extrusion, like this
import bpy, bmesh
mesh = bmesh.from_edit_mesh(bpy.context.object.data)
for v in mesh.verts:
if v.co[2] > 0.0:
v.select = True
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.extrude_region_move(...)
and then the extrude behaves like this
So I have a couple questions. Why does it do this? And is there a better way? What should I be doing instead?