1

I'm trying to select just the new vertices after using poke face, this is what I have so far, but it doesn't work if I use poke on multiple connected faces. Any ideas?

import bpy
bpy.ops.mesh.poke()
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
bpy.ops.mesh.select_less()
Kuzey 3D
  • 71
  • 4
  • https://blender.stackexchange.com/questions/43127/how-do-i-select-specific-vertices-in-blender-using-python-script – Karan May 16 '21 at 05:19

2 Answers2

2

Use bmesh.

Recommend using the bmesh module, to avoid mode toggling and other insanity.

Input the faces into the bmesh.ops.poke operator and it returns a dictionary of the newly created geometry. (faces and verts)

import bpy
import bmesh

context = bpy.context

ob = context.edit_object me = ob.data bm = bmesh.from_edit_mesh(me)

faces = [f for f in bm.faces if f.select]

poked = bmesh.ops.poke( bm, faces=faces, )

print("New verts", poked["verts"])

batFINGER
  • 84,216
  • 10
  • 108
  • 233
1

you might try the return value of the operator

poked = bpy.ops.mesh.poke()
verts = poked['verts']
for v in verts:
    v.select = True

You could also do select in object mode:

verts = [v.index for v in verts]
for v in verts:
    ob.data.vertices[v].select = True
ob.data.update()
Rich Colburn
  • 424
  • 4
  • 5