Skip to content

Instantly share code, notes, and snippets.

@kamino410
Created April 20, 2017 06:25
Show Gist options
  • Select an option

  • Save kamino410/78ce4824d4138d841cfa1ca25b375b2d to your computer and use it in GitHub Desktop.

Select an option

Save kamino410/78ce4824d4138d841cfa1ca25b375b2d to your computer and use it in GitHub Desktop.
#メッシュの作製
mesh = bpy.data.meshes.new("new_mesh")
#点を描画する場合
mesh.from_pydata([(0,0,0),(1,0,0),(1,1,0)], [], [])
mesh.update()
#加えて線を描画する場合(何番目の点と何番目の点を結ぶかのリストを渡す)
mesh.from_pydata([(0,0,0),(1,0,0),(1,1,0)], [(0,1),(1,2),(2,0)], [])
mesh.update()
#加えて面を描画する場合)
mesh.from_pydata([(0,0,0),(1,0,0),(1,1,0)], [], [(0,1,2)])
mesh.update(calc_edges=True)
#追加
object_utils.object_data_add(bpy.context, mesh, name="mesh1")
#pointerを原点に戻す
bpy.context.scene.cursor_location = (0,0,0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment