Can you write me a blender script to make a donut?
- User
Can you write me a blender script to make a donut?
- Assistant
Certainly! Here's an example of a Blender Python script to create a donut mesh:
import bpy import math # Set the radius and thickness of the donut radius = 1 thickness = 0.5 # Set the number of vertices per circle resolution = 32 # Create the outer and inner circles outer_circle = [(radius + thickness * math.cos(2 * math.pi * i / resolution), thickness * math.sin(2 * math.pi * i / resolution), 0) for i in range(resolution)] inner_circle = [(radius * 0.6 + thickness * math.cos(2 * math.pi * i / resolution), thickness * math.sin(2 * math.pi * i / resolution), 0) for i in range(resolution)] # Create the faces between the circles faces = [] for i in range(resolution): face = (i, (i + 1) % resolution, ((i + 1) % resolution) + resolution, i + resolution) faces.append(face) # Create the mesh mesh = bpy.data.meshes.new("Donut") mesh.from_pydata(outer_circle + inner_circle, [], faces) # Create the object and link it to the scene obj = bpy.data.objects.new("Donut", mesh) bpy.context.scene.collection.objects.link(obj)This script uses Blender's bpy module to create a donut mesh with the specified radius, thickness, and resolution. It creates two circles (outer and inner) using trigonometric calculations, and then defines the faces between the circles. Finally, it creates a mesh object from the vertex and face data, and links it to the Blender scene.
You can run this script within Blender's Text Editor, or by saving it as a .py file and using the "Scripting" workspace in Blender to run it. It will create a donut object in the Blender scene.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →