Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- import bmesh
- import random
- def deselect(bm):
- for f in bm.faces:
- f.select = False
- def pick_two_random_faces(bm):
- for i in random.sample(range(len(bm.faces)), 2):
- bm.faces[i].select = True
- # Get the active mesh
- obj = bpy.context.edit_object
- me = obj.data
- # Get a BMesh representation
- bm = bmesh.from_edit_mesh(me)
- bm.faces.ensure_lookup_table()
- bm.faces.active = None
- deselect(bm)
- for i in range(10):
- pick_two_random_faces(bm)
- bpy.ops.mesh.add_curvebased_tube(main_scale=0.3)
- deselect(bm)
- # Show the updates in the viewport
- # and recalculate n-gon tessellation.
- bmesh.update_edit_mesh(me, True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement