Skip to content
TheChatArchiveThe Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)Hugging Face OpenAssistant Conversations (oasst2)

Can you write me a blender script to make a donut?

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    Can you write me a blender script to make a donut?

  2. Assistant

    Sure! Here's a Blender script that generates a donut:

    import bpy
    import numpy as np
    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 * np.cos(2 * np.pi * i / resolution), thickness * np.sin(2 * np.pi * i / resolution), 0) for i in range(resolution)]
    inner_circle = [(radius * 0.6 + thickness * np.cos(2 * np.pi * i / resolution), thickness * np.sin(2 * np.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
    object = bpy.data.objects.new("donut", mesh)
    bpy.context.scene.collection.objects.link(object)
    

    This script creates a donut mesh with the specified radius and thickness, and a resolution of 32 vertices per circle. It then creates the faces between the circles and generates the mesh. Finally, it creates the object and links it to the scene. You can adjust the parameters to generate different sizes and styles of donuts.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.