Skip to main content
added 126 characters in body
Source Link
rien333
  • 91
  • 1
  • 10

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
    bm.select_history.add(v)
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

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
vertices = get_some_vertices(bm)

for v in vertices:
    v.select = True
    bm.select_history.add(v)
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

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
    bm.select_history.add(v)
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
Source Link
rien333
  • 91
  • 1
  • 10

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
vertices = get_some_vertices(bm)

for v in vertices:
    v.select = True
    bm.select_history.add(v)
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