Generate a python script that works in Blender 3.4.1 that creates 200 curves that…
- User
Generate a python script that works in Blender 3.4.1 that creates 200 curves that overlap and combine to look like a road network.
- Assistant
Here's a Python script that creates 200 curves in Blender 3.4.1 that overlap and combine to look like a road network:
import bpy import random # Set the number of curves to create num_curves = 200 # Set the size of the road network size = 20 # Set the height of the road network height = 0.5 # Create an empty list to hold the curves curves = [] # Create the curves for i in range(num_curves): # Create a new curve curve = bpy.data.curves.new('Curve', 'CURVE') curve.dimensions = '3D' spline = curve.splines.new('BEZIER') # Set the start and end points of the curve start = (random.uniform(-size, size), random.uniform(-size, size), height) end = (random.uniform(-size, size), random.uniform(-size, size), height) spline.bezier_points.add(2) spline.bezier_points[0].co = start spline.bezier_points[1].co = (start[0] + random.uniform(-size/2, size/2), start[1] + random.uniform(-size/2, size/2), height) spline.bezier_points[2].co = end # Add the curve to the scene obj = bpy.data.objects.new('Curve', curve) bpy.context.scene.collection.objects.link(obj) curves.append(obj) # Combine the curves into a single object bpy.ops.object.select_all(action='DESELECT') for curve in curves: curve.select_set(True) bpy.context.view_layer.objects.active = curves[0] bpy.ops.object.join() # Convert the curves to a mesh bpy.ops.object.convert(target='MESH') - User
Now load all of the models in a folder called 'cars' and randomly apply them to the surface of the roads. Ensure they don't overlap with each other and provide a configuration variable called car_density that determines how many are added.
- Assistant
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 →