Skip to content

Instantly share code, notes, and snippets.

@pcote
Created December 11, 2016 18:18
Show Gist options
  • Save pcote/db291daa3d6bd60b9f3a29db34302905 to your computer and use it in GitHub Desktop.
Save pcote/db291daa3d6bd60b9f3a29db34302905 to your computer and use it in GitHub Desktop.
A stripped down script that creates a single poly mesh. That is all.
import bpy
import bmesh
if __name__ == '__main__':
verts = [(-5, 0, 0),
(5, 0, 0),
(2, 5, 0),]
mesh = bpy.data.meshes.new("mymesh")
bm = bmesh.new()
for vert in verts:
bm.verts.new(vert)
bm.verts.ensure_lookup_table()
faces = [[0,1,2], ]
bm.faces.new([bm.verts[0], bm.verts[1], bm.verts[2]])
bm.to_mesh(mesh)
mesh.update()
ob = bpy.data.objects.new("meshob", object_data=mesh)
scn = bpy.context.scene.objects.link(ob)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment