Can ChatGPT generate valid .gh files for Grasshopper?

Hi all,
I’ve been testing ChatGPT’s ability to generate .gh or .ghx Grasshopper files. While it provides accurate step-by-step guides and can simulate .ghx files in XML format, those files aren’t readable by Grasshopper.

From what I understand, .gh files are binary files with internal GUIDs and Rhino-specific data. So my question is:

:backhand_index_pointing_right: Is it possible to programmatically generate valid .gh files outside Rhino’s environment?
If not, are there any tools, APIs, or workflows (e.g. Rhino.Compute, scripting via Rhino Inside) that could bridge this gap?

Thanks in advance!

Yes and no. I could do it :wink: , because I know how to reverse-engineer such a binary serializer. But it is a significant effort. Without knowing the logic how to read and write the bytes, it is impossible to work with it. Binary files very often have a header and data section, but you need to know how many bytes you need to read in advance and how to cast it. (Some formats, like .dwg files even read bit- not byte-wise and apply compression, which is even more challenging). So in the end, I would claim that its feasible, but its likely not worth the effort.

2 Likes

Thanks a lot for the detailed explanation — that makes perfect sense. I really appreciate the clarity. It confirms that sticking with scripted workflows or .ghx is the more practical path for now. Cheers!