AI programming of Rhino

,

Question:

I have zero programming skills.
But can I use i.e. ChatGPT to generate code for use in Rhino?

Hope someone has experience here.
Thanks.

I use it all the time for python scripts so the answer is yes.

However, does it give you the correct result? Usually not exactly. You still need to learn the coding language and API methods available to help “guide” it.

It’s important to let it know you are using grasshopper if using GH Scripting Components because by default it will want to script for Rhino (and does a better job of it) so be sure to distinguish the context.

I’ve had most success with taking existing working code or almost working code and then having ChatGPT modify it to expand or optimize it.

Sometimes it works first go, but I’ve found you have to hand hold a bit and be very specific on changes like “without modifying my corrected code, how can we expand the logic to handle list access for input “x”” and it usually will then give you a loop no problem.

It also gets confused sometimes and tries to use a method like “GetType” on something that isn’t available so you still need to troubleshoot and modify or have it correct the code by suggesting "GetType isn’t a method in Rhino.Geometry , please use the method “Type” instead. (this is just a fake example)

That being said, given that I am NOT a programmer and just getting started in python it still takes me probably 10-20 go arounds with ChatGPT to get exactly what I want in a intermediate complexity script.

@mwickerson has a lot of examples

1 Like