I have two meshes: (A and B) that are partly overlapping and have some vertices with different indices but the exact same global location. I would like to look at the vertex locations of mesh A and select the vertices with the same location within mesh B.
My attempt modifying some code snippets:
vertices = []
bpy.context.view_layer.objects.active = bpy.data.objects['A']
bpy.ops.object.editmode_toggle()
obj=bpy.context.object
if obj.mode == 'EDIT':
bm=bmesh.from_edit_mesh(obj.data)
for v in bm.verts:
vertices.append(obj.matrix_world @ v.co)
else:
print("Object is not in edit mode.")
bpy.ops.object.editmode_toggle()
#print(vertices)
bpy.context.view_layer.objects.active = bpy.data.objects['B']
bpy.ops.object.editmode_toggle()
if obj.mode == 'EDIT':
bm=bmesh.from_edit_mesh(obj.data)
for v in bm.verts:
if v in vertices:
v.select
I highly appreciate your help!
obj.matrix_world @ v.co
) $\endgroup$if v.co in vertices
btw the error would have been spotted more easily if you used more descriptive names egvertex_coordinates
instead ofvertices
$\endgroup$