1
$\begingroup$

I'm new scripting Blender but I could write the following:

import bpy
obj_name = "maki"
mesh_data = bpy.data.meshes.new(obj_name + "_data")
obj = bpy.data.objects.new(obj_name, mesh_data)
bpy.context.scene.objects.link(obj)
# Sample vertex data
verts = [(0.154, 0.5151, 2.213), (2.847, -3.15, 0.151), (1.247, -1.105, 0.965)]
mesh_data.from_pydata(verts, [], [])

Is this the right way to do that?

$\endgroup$
  • $\begingroup$ Looks good. You've got 2 options, Bmesh (more flexible) and without Bmesh (easier). $\endgroup$ – brockmann Jul 15 '17 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.