Whenever I use a script to separate a mesh by means of a selection the separated mesh contains no edges (only vertices). In contrast, separated meshes always contain edges when either manually selecting and separating within the GUI or selecting manually and then separating in the python console. I use the following code to separate a mesh:

bm = bmesh.from_edit_mesh(bpy.data.objects['OBJECT_NAME'].data)

# Generate a certain set from vertices from the bmesh
# This function only generates vertices that are connected by edges
# and form a rectangular shape over the mesh 
vertices = get_some_vertices(bm)

for v in vertices:
    v.select = True

If make a selection manually, and then just run >>> bpy.ops.mesh.separate(type='SELECTED') in the console the result contains edges, as expected.

Can anyone reproduce this or explain why my new mesh does not have edges given my code?

$ blender --version # (tried another version as well)
Blender 2.79 (sub 2)
build date: 2018-02-22
  • $\begingroup$ My end goal is to nicely fill in my separated selection with the "F" key, so if anyone knows how to do so for a set of unconnected vertices programmatically that would also help. $\endgroup$
    – rien333
    Feb 22 '18 at 20:58

Instead of selecting vertices of the bmesh, one should additionally select the corresponding edges and faces to create a new mesh containing them. It seems that when programmatically operating on a bmesh blender is a bit more literal on what you select than it is when selecting manually in edit mode.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.