Setting a seam in bmesh

I am trying to set a seam via a BMEdge object and am failing miserably. Am I missing something?

In the following demo script I would have expected to see a cube, twice normal size with all its edges set to be seams. Instead I get a cube twice normal size with no seams set. The script generates no errors when I run it.

Thank you for any suggestions,
- Bob

— demo.py —
import bpy
import bmesh

bpy.ops.mesh.primitive_cube_add()
cube = bpy.context.object

bm = bmesh.new()
bm.from_mesh(cube.data)

Check that some changes get through - the doubling does

for vertex in bm.verts:
vertex.co *= 2.0

But seam setting doesn’t

for edge in bm.edges:
edge.seam = True

bm.to_mesh(cube.data)

Works for me, are you sure Seams are enabled in toolshelf, Mesh Display?

You can enable it programmatically like:
cube.data.show_edge_seams = True

1 Like

Thank you! That was exactly the problem. Not sure how it got unset, but it was.

It might actually be false by default. You usually won’t notice it being turned off however, because the mark seam operator enables it.