Respected all, I have on 3D mesh and I have to add only one single face in between selected all vertices using python API and I have selected the multiple vertices using python and added face using python but the multiple faces are getting added can you please help me out to add only single face in between all selected vertices.
This is given below code:-
import bpy
import bmesh
def extract_vertex(indx_data):
ind_d = []
with open(indx_data,"r") as b:
lines = [line.strip() for line in b.readlines()]
for l in lines:
ind_d.append(int(l))
return(ind_d)
indx_data = "indices.txt"
final_list_16 = extract_vertex(indx_data)
bpy.ops.import_mesh.ply(filepath='demo.ply')
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_mode(type='VERT')
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
for i in final_list_16:
obj.data.vertices[i].select = True
bpy.ops.object.mode_set(mode = 'EDIT')
bm = bmesh.from_edit_mesh(obj.data)
bm.verts.ensure_lookup_table()
set_of_verts = set(bm.verts[i] for i in final_list_16)
bm.faces.new(set_of_verts)
bpy.ops.object.mode_set(mode='OBJECT')
Any leads will be appreciated. Thanks in advance