Hello, I have been searching and can't seem to find how to select specific vertices of a mesh.
What I'm trying to do:
I am first adding a cylinder primitive with end fill set to "TRIFAN". Once this is completed, I want to then be able to select the center vertex in order to move it downward, effectively creating a pin/point. The problem is finding a way to select the center vertex in order to reposition it and pull this off. Any help is greatly appreciated.
if your problem is finding the center top vertex, I think you can safely assume it is always vertex at index 1. I tried with various cylinders, with odd and even sides and it always selected the top vertex in the center of the triangle fan. If you are interested in the center bottom vertex, use index 0 in place of 1.
mesh = bpy.data.objects['Cylinder'].data
mesh.vertices.co.z += 0.25
If you actually want to select vertices, here I have some code adapted from
http://blenderartists.org/forum/showthread.php?207542-Selecting-a-face-through-the-API&highlight=ow%20do%20I%20select/deselect%20vertices/edges/faces%20with%20python in order to work on current Blender release 2.63.
o = bpy.data.objects['Cylinder']
bpy.context.scene.objects.active = o
sel_mode = bpy.context.tool_settings.mesh_select_mode
bpy.context.tool_settings.mesh_select_mode = [True, False, False]
mesh = o.data
mesh.vertices.select = True
bpy.context.tool_settings.mesh_select_mode = sel_mode