as far as I understand the GH_IO.dll converts .gh files to .ghx files, which is not really what I want to do. I don’t have .gh files available, I need to write the .ghx files from scratch.
Unless you’re talking about decompiling the GH_IO.dll file to maybe get some hints about the .ghx file structure? I think, digging into the .ghx tree by hand will probably give me a better understanding.
It can do that, but it does much more. the gh and ghx formats are binary and xml flavoured serialisations of a strongly-typed-and-indexed-hierarchical-dictionary which is used in-memory to (de)serialise all manner of data.
Although there are common patterns, it is up to each individual component to decide how it wishes to store its data, so you cannot simply predict what the exact contents of a gh file will be given some component.
GH_IO can be used to read gh and ghx files and load them into the dictionary type in memory. It can be used to modify the dictionary (add or remove values and chunks) and ultimately save it to a gh or ghx file again. But the file format is utterly unaware of Grasshopper and Rhino itself. It has no idea what sort of data it is storing, or what it might mean, or what signifies invalid or corrupt data.
GH_IO can be used to read gh and ghx files and load them into the dictionary type in memory. It can be used to modify the dictionary (add or remove values and chunks) and ultimately save it to a gh or ghx file again
Can I see the structure of this dictionary somewhere?
Would it be possible to create this dictionary in Python and then convert it to .gh or .ghx with the help of the GH_IO.dll?