Grasshopper

algorithmic modeling for Rhino

Long ago when Grasshopper was still called Explicit History it used a file format called WRM. This was a terrible format and support for it was slowly dropped over time. These days you can save your Grasshopper data in two ways; GH and GHX. Since Grasshopper 0.8.0050, the default format is GH.

GH obviously stands for 'GrassHopper' and GHX adds an X for Xml. There is no functional difference between GH and GHX files concerning information content, however they are obviously not the same.

Grasshopper data is stored in a hierarchical, type-safe database format which is defined and managed by the GH_IO.dll library. These databases can be read from and written to binary and text-based files.

GH is a binary format, meaning it stores its data as pure bytes. This makes the file unreadable by human eyes and also rather difficult to parse by programs. Data inside GH files is however stored quite efficiently -i.e. with little overhead- and it is even compressed using standard Deflate compression, reducing the file size even more.

GHX on the other hand is text based, meaning all data is stored as human-readable strings of characters. This means there is in fact a large amount of overhead needed and GHX files will be 10 to 100 times as big as GH files. When Grasshopper puts data in the clipboard, it is stored as GHX.

Why do we need both formats and when should you use one or the other?

Benefits of GH over GHX:

  • Much smaller footprint. Saves and loads faster from/to a slow medium.
  • GH is unknown to all software except Grasshopper. There is no risk of anything trying to parse it behind your back. A common problem with GHX is that webbrowsers and email clients try to interpret xml data, potentially ruining it.

Benefits of GHX over GH:

  • GHX can be easily parsed, modified and even written using manual text-editors or programs without the need to use GH_IO.dll.
  • If a GHX file gets damaged it's possible in theory -though often still rather difficult in practice- to recover parts of it. This is not possible at all with damaged GH files.

Basically, you're almost always better off using GH. Only if you want to interact with the Grasshopper data without using the Grasshopper interface does it really make sense to use GHX.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Views: 10709

Replies to This Discussion

Very interesting. Thanks for the explanation :)

@David Is it possible to extract from ghx an adjacency matrix between grasshopper components in an excel format? It may be extremely useful the potential for meta-analysis of GH definitions using network science theoretical framework. For instance the study of modularity between equivalent definitions..

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service