I am trying to generate a bunch of points from a bezier curve. I am converting my curve to mesh then gather vertices then delete the mesh as discussed by helpful contributors in the past.
But the points I generated do not match the curve 3D location. Please see attached screenshot, blender file, and code.
To recreate my problem: 1. create a bezier curve 2. manually move bezier curve on all 3 axies 3. run the python script 4. see points generated do not correspond to the new 3D locations of the curve but rather match its original position only (when it was created at origin).
Thank you!
#https://blender.stackexchange.com/questions/34145/calculate-points-on-a-nurbs-curve-without-converting-to-mesh
import bpy
obj = bpy.context.object
scene = bpy.context.scene
obj_mesh = obj.to_mesh(scene, True, 'PREVIEW')
verts = [v.co for v in obj_mesh.vertices]
print("total numbers of vertices generated = %d"%len(verts))
for i in verts:
bpy.ops.mesh.primitive_uv_sphere_add(size=0.05, location=i)
bpy.data.meshes.remove(obj_mesh)

