0

I'm trying to create new faces on a mesh as per the image. End result should be the triangle split to 3 faces each having 4 edges.

For some reason following code does not connect the edges, the new vertex in the middle gets created though. Using Blender 2.93.2

bm = bmesh.new()
bpy.ops.object.mode_set(mode='EDIT')
bm.from_mesh(mesh)
bpy.ops.object.mode_set(mode='OBJECT')  # return to object mode
bm.edges.ensure_lookup_table()

for poly in bm.faces: center = bm.verts.new(poly.calc_center_median_weighted()) for vertex in poly.verts: if vertex.select: bmesh.ops.connect_verts(bm, verts = [center, vertex])

make the bmesh the object's mesh

bpy.ops.object.mode_set(mode='OBJECT') # return to object mode bm.to_mesh(mesh)
bm.free()

I also tried to create a new face using bmesh api, but having the newly created "center" vertex on the parameter list crashes blender.

trying to create these faces

KJS
  • 237
  • 1
  • 9

0 Answers0