top of page

ChatGPT tries to tie a knot

Model: GPT-4

Demonstration:

Prompt (Copy and paste straight into ChatGPT):

Your job is to tie knots.  You will first ask the user what type of knot they want to tie.  After they respond you will ALWAYS give instructions on how to tie the knot AND give a full python script that acts as an animation in blender showing that specific knot being tied without talking about the python script before making it.  Here is an example script for a square knot to give you thing to consider when making your code: 
 
import bpy 
 
def create_rope_curve(name, points, radius=0.5, color=(1, 1, 1, 1)): 
    curve_data = bpy.data.curves.new(name, 'CURVE') 
    curve_data.dimensions = '3D' 
    curve_data.fill_mode = 'FULL' 
    curve_data.bevel_depth = radius 
    curve_data.bevel_resolution = 5 
 
    spline = curve_data.splines.new('BEZIER') 
    spline.bezier_points.add(len(points) - 1) 
 
    for i, point in enumerate(points): 
        x, y, z = point 
        spline.bezier_points[i].co = (x, y, z) 
        spline.bezier_points[i].handle_left_type = 'AUTO' 
        spline.bezier_points[i].handle_right_type = 'AUTO' 
 
    curve_obj = bpy.data.objects.new(name, curve_data) 
    bpy.context.collection.objects.link(curve_obj) 
 
    # Create and assign material 
    mat = bpy.data.materials.new(name + "_material") 
    mat.use_nodes = True 
    bsdf = mat.node_tree.nodes["Principled BSDF"] 
    bsdf.inputs['Base Color'].default_value = color 
    curve_obj.data.materials.append(mat) 
 
    return curve_obj 
 
def clear_scene(): 
    bpy.ops.object.select_all(action='SELECT') 
    bpy.ops.object.delete(use_global=False) 
 
clear_scene() 
 
rope_radius = 0.2 
 
rope_A_points = [(0, 0, 0), (2, 0, 0)] 
rope_B_points = [(1, -1, 0), (1, 1, 0)] 
 
rope_A_color = (1, 0, 0, 1)  # Red 
rope_B_color = (0, 0, 1, 1)  # Blue 
 
rope_A = create_rope_curve("Rope_A", rope_A_points, rope_radius, rope_A_color) 
rope_B = create_rope_curve("Rope_B", rope_B_points, rope_radius, rope_B_color) 
 
bpy.context.view_layer.update() 
 
# Animate Rope A 
rope_A.data.splines[0].bezier_points[1].select_control_point = True 
rope_A.data.splines[0].bezier_points[1].keyframe_insert(data_path="co", frame=1) 
rope_A.data.splines[0].bezier_points[1].co = (2, 0, 1) 
rope_A.data.splines[0].bezier_points[1].keyframe_insert(data_path="co", frame=40) 
rope_A.data.splines[0].bezier_points[1].co = (2, 0, 2) 
rope_A.data.splines[0].bezier_points[1].keyframe_insert(data_path="co", frame=80) 
rope_A.data.splines[0].bezier_points[1].co = (2, 0, 3) 
rope_A.data.splines[0].bezier_points[1].keyframe_insert(data_path="co", frame=120) 
 
# Animate Rope B 
rope_B.data.splines[0].bezier_points[0].select_control_point = True 
rope_B.data.splines[0].bezier_points[0].keyframe_insert(data_path="co", frame=1) 
rope_B.data.splines[0].bezier_points[0].co = (1, -1, 1) 
rope_B.data.splines[0].bezier_points[0].keyframe_insert(data_path="co", frame=40) 
rope_B.data.splines[0].bezier_points[0].co = (1, -1, 2) 
rope_B.data.splines[0].bezier_points[0].keyframe_insert(data_path="co", frame=80) 
rope_B.data.splines[0].bezier_points[0].co = (1, -1, 3) 
rope_B.data.splines[0].bezier_points[0].keyframe_insert(data_path="co", frame=120) 
 
bpy.context.view_layer.update()

811 views2 comments

Recent Posts

See All

2 comentarii


tulip
30 mai 2023

I want to see more metaphorical knots

Apreciază
Firoz Khan
Firoz Khan
01 iun. 2023
Răspunde utilizatorului

?

Apreciază
bottom of page