Can Claude do GH? (Part 1.1, 1.2, and 1.3)

I started again after 11:00 PM with what I thought would be a new session but only was allocated enough time to do about 3 more test runs. Each of those failed with some sort of error. So I gave up for the night and started again the next morning - this morning 04 May.

After several repeated attempts it finally came up with a Python script that worked. The script generated this geometry:

This is exactly what my initial prompt specified: 7 cubes of increasing size spaced out along a circular arc, all of which are connected by a GH Pipe running through their centers.

I thought this was a major breakthrough, but still not the native GH file I wanted to see. So I continued to try to get it to make a real GH file with real GH components - I told it I did not want any Python code in the final GH file.

So we went through another series of trials during which it fixed various GH file loading errors. I ran out of time again so paid 20 dollars to get a one month subscription. Needless to say Anthropic was happy to take my money.

The trial and error process continued. Each time the generated GH file produced a loading error it would analyze the result and make a new attempt. It was able to generate a working GH file that contained the required GH components, but with no connecting wires. I ran out of time (again) after it said it knew what the problem was and was about to give me the final result. So I’ll try to get back later today and see if I can get it to reconstruct that file for download. My questions now are:

  1. Is McNeel going to get mad at me for helping to train it to generate GH files?
  2. Will Anthropic be interested in adding GH generation capability to it’s AI software?
  3. Am I the only human who is interested in this?

It looks like this is not going to work. I ran out of time again - but I found a new (to me at least) feature of Anthropic that lets people in an organization design things. So I told it I wanted it to make a native GH file with no Python and it basically said it could not do that. But it did construct a ā€œmockupā€ diagram of what my GH file should look like. I expected something pretty ugly, but not as ugly as what it gave me:

I may try again later tonight with Claude - or maybe just give up. It’s pretty clear that the native GH format is quite complex and obscure. It could be that only a human is able to make a workable GH file.

Short answer- no.
we do not dictate how our users work.

Good to know - thanks.

Grasshopper exists to translate machine logic into something humans can read and manipulate visually. In my opinion, using AI to generate Grasshopper scripts means going from human language to AI, then back to a human-readable graph, then back to the machine: a roundabout path that adds complexity without adding value. If you do not understand Grasshopper, having a graph generated by AI will not help you use, modify, or debug it; it is exactly like receiving code written by someone else without understanding the syntax. So why invest in an AI layer that generates Grasshopper scripts, when you could just use AI directly?

So why invest in an AI layer that generates Grasshopper scripts, when you could just use AI directly?

The answer is to make it easier and quicker for humans to transform some geometry that does not yet exist but that can be well described into something real that exists in the real world. This would eliminate the need to learn how to manipulate complex systems like Rhino and GH, and instead replace all that with a direct brain to real 3D structures.

I’ve been using GH (and not Rhino) for quite a while to make 3D printed objects of various kinds. Consequently I have a good understanding of what current day software can do. I thought it would be interesting to see if there was a way to completely hide the software step and go directly from an accurate description (prompt) to a machine readable output for production. GH/Rhino is the only software I know about now that can do that - although of course there are others.

At this point it’s not at all clear to me that Claude - or any other AI product - can do this - but I’m not giving up. Yet.

Hello
I use Grok quite a lot for C#, it isn’t flawless but helps a lot to give the state of the art tools to solve some common problems. Here a question on your subject
https://x.com/i/grok/share/6d06407e34704156a435b6978e205b14

Just some insights from something related: I am working on ways to have Claude help build files for vvvv, which is similar to GH in that it is a visual programming language. What I found is that before you can let it help you BUILD files it first needs to be able to do the reverse and know how to deconstruct and understand files. In vvvv files are constructed using basically XML and are not very easy to read at all, also because you are basically building C# visually and the structure of the code is much more modular than in GH, which is bascially just one linear graph with some nesting.

But I think its a good excercise to give Claude a bunch of .gh files and have it interpret and learn from those how they are structured. You might have it build a visual prototype of the patch in a simple HTML file for example or using some diagramming using the d3 library. It will learn a lot and in the end you can have it create a markdown file with everything it has learned reverse engineering the files. It can then use that to do the opposite and try to construct files.

For the available nodes have it crawl something like Grasshopper Component Index | Grasshopper Docs .

I think it will get you quite far.

Just out of curiosity, do you just want an alternative to something like https://www.food4rhino.com/en/app/raven or do you want to take a different approach by actually having Claude create .gh files?

What I mean is:

if you can think of the process of modeling your parametric geometry, you can do it yourself in GH;
if you don’t know the process (or just a part of it) but you just have your parameters and you want the result, you can ask for a Python/C# node to have your parametric objects.

Trying to train AI to convert a prompt into VPL that generates your things sounds strange.
You can do it if you want for example to have some sort of templates of how your components are placed/grouped/etc but it’s a lot of work

I have used AI multiple times to create solutions not available anywhere in GH world (eg. data recorder with add od remove buttons).

You can be easily tricked into ā€˜solution’ if you don’t know what exact output you are expecting.

I am confused. Isn’t that exactly what Raven is doing? Except it doesn’t build you the file it just runs in the editor? What’s wrong with that?

I think I would much rather it builds me an actual solution using native components than some black-box of code. Of course its much better at coding, but it also means it will stay code forever, which then loses the abilities of visual programming in the first place, ie. You can inspect exactly how data flows at every intersection.

Nothing wrong with that, but in my opinion it can be counterproductive.

If I know how to write in the canvas a certain workflow, I will do it my way and with my style (node placement / grouping / colors / input parameters and output objects visually grouped like I want / data tree management / etc);
If I have a particular part of the modeling that I cannot solve myself, I will brainstorm with Claude and I will come up with a logic to implement in the canvas or a Python/C# node;
Later, If I have a standardized workflow (or a part of it) that I know I will reuse I will convert it in a Cluster/Python/C# and save it as user object.

If I use Raven, for example looking at one of the latest video on the YT channel (Sketch to CAD: Parametric Bridge with Images), I get this:

WTH is that canvas? what are you expecting to understand from it?

how is it less-black-box rather than asking for a C#/Python node (that can be readable if you ask for comments)? Will you understand it better than code if you open it next week (or just tomorrow (or just in one hour))?

If you need just a oneshot black-box script that’s ok, otherwise I’d prefer brainstorming with Claude and doing things myself with order

Thanks to everyone for your fascinating and illuminating responses - I’ll give specific replies below. But to answer in general here’s what led to this topic in the first place:

About 6 years ago I got into 3D printing as a hobby. (It’s both less expensive and less dangerous than previous ones: model railroading, wood turning, and general wood working.) I started using GH because for me it had a much shorter learning curve than Rhino, Autocad, Catia etc. Because I am just a hobbyist I have no external time or design constraints, and I often do designs (or try to) based on things I see in the real world.

My GH skills are what I’d call mediocre, but they are good enough to get me to a printable result in most cases. When I get stuck I’ll usually post something in the GH forum, and that usually fixes things. But with the advent of AI I thought what if I could get an AI agent do the GH part after I give it a concise definition of what I want the printed result to be. (This follows the old IBM adage ā€œPeople should think, machines should work.ā€)

Of course my concept of getting AI to do the real work developed with no knowledge of how the contents of a GH screen gets transformed into the Rhino commands that produce actual output. This, it turns out, was a fatal mistake. But at least I learned a lot about how AI agents actually work, and what GH files really are.

Laurent: the Grok discussion you posted is terrific - thanks. I wish I had been aware of it before I started all this. It’s explanation of why AI really can’t duplicate a the contents of a GH file is spot on. And it makes clear that my insistence on telling Claude I don’t want any Python in it’s solution is actually a non-starter.

Armin: I’ve not heard of vvvv so I can’t comment on that. But your point about ā€œreverse engineeringā€ is spot on, and your suggestion to give Claude a bunch of completed GH files to enable it to learn how they are constructed is something I totally missed. Consequently I’m re-thinking what my next interaction with Claude should be like - I’ve got till June 5 before my 1 month subscription expires.

And yes, my original objective was to have Claude generate a working GH file (one with no Python in it) based on design specs I gave it.

Finally - I was unaware of Raven, but it looks like something that could definitely help me when I get stuck with GH. Thanks for the reference - I’m looking forward to checking it out.

Fabio - yes, I severely underestimated and mis-understood what it would take for an AI agent to construct a working GH file. I really do try to avoid wishful thinking - but I’m not always successful at doing that.

Surprise: would you believe the answer to my original question is ā€œYes - sort ofā€?

Well, how about this:

Silly I know - but I made the prompt straight out of my head without really thinking much. The Claude result was exactly what I asked for - but I had to tweak it a tiny but because I had the spatial relationship between the spheres and the spiral pipe not quite correct.

What’s most interesting is the way Claude did it. It took about 25 repeated attempts at making a Rhino Python script that created a .gh file on my desktop. Now keep in mind I don’t do Python, but apparently there are some obscure ways of naming GH/Rhino things in Python that are not typically standard. (Which is just one reason I don’t do Python.)

Also - I now have Raven installed in GH. I’ve just done a few things with it, but the darned thing actually works. Needless to say you have to be quite precise with the prompts you give it (this is not new news), but I think it’s going to be a great help to most anyone using GH.