Hello, I have no idea how to use Python scripting. I was wondering if anyone has made a script for Python to output the location and number of the vertices of an object to a text file, for example it would look something like this:
I saw a video of a guy who did this with Maya here:
He did not provide the script for it. Maya provides the numbers for each vertices on screen. Can a script for Blender do the same? If so how do I run a script command? I see Python running on the top of blender but can’t use it. Will that be a hard script to create for someone who has no idea of Python? Is it a simple things to create for someone who knows Python scripting? Could someone here even create it?
This writes the vertex coords of the active object (needs to be type MESH) in world space to a file (dump.txt):
import bpy
with open("dump.txt", "w") as file:
ob = bpy.context.object
mat = ob.matrix_world
me = ob.data
for v in me.vertices:
file.write("Vert%i [%.2f, %.2f, %.2f]
" % ((v.index,) + (mat*v.co)[:]))
For Vertex Indices on screen, go to Python Console:
bpy.app.debug = True
Then open the N-toolshelf in the 3D View. Active object needs to be a mesh in edit mode. Locate the Mesh Display panel and turn on Indices option (at the bottom, Edge Info). Make sure mesh selection mode is vertex. You can achieve the same by running this in the Text Editor:
import bpy
bpy.app.debug = True
ob = bpy.context.object
if ob is None:
raise Exception("No active object")
if ob.type != 'MESH':
raise Exception("Not a mesh object")
if ob.mode != 'EDIT':
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
me = ob.data
me.show_extra_indices = True
bpy.context.tool_settings.mesh_select_mode = (True, False, False)