Blender 3D — How to create and render a scene in Blender using Python API | Spltech Smart Solutions

PHOTO EMBED

Sat Aug 06 2022 21:51:25 GMT+0000 (Coordinated Universal Time)

Saved by @catafest

import bpy

vertices=[(1,1,-1),(1,-1,-1),(-1,-1,-1),(-1,1,-1),(1,1,1),(1,-1,1),(-1,-1,1),(-1,1,1)]
edges=[]
faces=[(0,1,2,3),(4,5,6,7),(0,4,7,3),(0,1,5,4),(1,2,6,5),(7,6,2,3)]

new_mesh=bpy.data.meshes.new("new_mesh")
new_mesh.from_pydata(vertices, edges, faces)
new_mesh.update()

#make object from the mesh
new_object = bpy.data.objects.new("new_object", new_mesh)

view_layer=bpy.context.view_layer
view_layer.active_layer_collection.collection.objects.link(new_object)
content_copyCOPY

blender 3d python

https://spltech.co.uk/blender-3d - how-to-create-and-render-a-scene-in-blender-using-python-api/