bmesh_simple.py 440 B

1234567891011121314151617181920212223
  1. # This example assumes we have a mesh object selected
  2. import bpy
  3. import bmesh
  4. # Get the active mesh
  5. me = bpy.context.object.data
  6. # Get a BMesh representation
  7. bm = bmesh.new() # create an empty BMesh
  8. bm.from_mesh(me) # fill it in from a Mesh
  9. # Modify the BMesh, can do anything here...
  10. for v in bm.verts:
  11. v.co.x += 1.0
  12. # Finish up, write the bmesh back to the mesh
  13. bm.to_mesh(me)
  14. bm.free() # free and prevent further access