# Scripting: separating selection results in edgeless mesh

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:

bpy.ops.object.mode_set(mode='EDIT')
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
bpy.ops.mesh.separate(type='SELECTED')


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

• 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. – rien333 Feb 22 '18 at 20:58