Has anyone actually received working Grasshopper code from AI?

Hi everyone,

I am trying to build a Mesh Analyzer in Grasshopper using the new Rhino 8 Python 3 Script Editor. I am using Rhino 8.15. To speed up the process, I tasked Google’s Gemini AI with writing the script for me.

However, the code provided by Gemini completely fails, throwing a runtime error and turning the Grasshopper component bright red. It seems the AI heavily struggles with the new .NET/CPython 3 environment and keeps mixing it up with legacy IronPython (Rhino 7) workflows.

Before I give up on using AI for this entirely, I want to ask a broader question to the community:

Has anyone here successfully used Gemini or other AI assistants like Claude or ChatGPT, Copilot to generate working, error-free Python 3 scripts for Rhino 8 from scratch? Which AI model is actually capable of handling the Script Editor and its data binding without crashing the component?

Python3 AI_ gemini attempt.gh (17.9 KB)

I’ve used Claude more than once, but of course there are always errors in the code. It’s just that with Claude, it seems to me, they’re not that difficult to fix, and once you’ve got a relatively stable version, it’s much easier to continue.

-Robert

I’d like to give a couple of recommendations:

  1. I don’t know why, but it seems to me that he writes plugins in C# better than Python scripts.
  2. I use the $20 version of Claude. :slight_smile:

I have managed this using the RhinoMCP as it can open Rhino, load the GH plugin and debug it and keep trying. You’ll want to use a later version of Rhino 8 though, 8.15 is old :slight_smile:

I already have quite a small collection of scripts done with ChatGPT.
My problem is now about how to organize them, move some from one category to another - the UI of grasshopper is quite limited when it comes to rearranging components and modifying their properties.

@Balazs , if the script gives you an error, copy the error from the terminal to your AI and it will attempt to solve it or give you more information about it.

Also useful is to split a big problem into smaller parts.