Join Chris Reilly for an in-depth discussion in this video Saving and baking Grasshopper files, part of Learning Grasshopper.
The algorithms that you build in Grasshopper are referred to generally as definitions. To save a definition in Grasshopper, you can use the File > Save or File Save As commands. When you save a Grasshopper definition, you'll choose a .gh for Grasshopper binary. We're at .ghx for Grasshopper XML. .gh is the default format and for most purposes, it's just fine. Since .gh files are encoded in binary, the files are smaller and your computer can generally read them more quickly. But .gh files can only be read by Grasshopper. Now sometimes this is a good thing because programs like email clients or web browsers might accidentally corrupt or mis-translate the xml in ghx files. Some users though might want the ability to access their Grasshopper files in a human readable format. For this GHX is a good option. Just keep in mind that the GHX files will be much larger than GH files. When we work in Grasshopper we can see how changes to our algorithm lead to realtime changes in Rhino. So I have a file here that's just generating a bunch of spheres along points in a box. And as I change things like the quantity or the size of the box I can see that those updates will take place in my file. But the geometry generated by grasshopper in rhino is not editable by default. It's just a preview so if I try to click or make other edits to Grasshopper geometry in Rhino, nothing happens. I can't actually effect that is being generated by Grasshopper, and if I were to close Grasshopper, or in this case if I were to just switch to a new blank document, that geometry disappears, so it is only when. This file is active, that I see that preview geometry in Rhino. Now if we'd like to convert our Grasshopper previews in to geometry that's editable in Rhino, we need to use the bake command. So to do that you just need to find the component whose geometry you'd like to convert in to editable geometry. Right click and select Bake. This brings up the bake attributes dialogue. And this allows us to control how and where our grasshopper geometry is converted into rhinogeometry. So we can do things like name the object or objects in this case maybe I'll call these spheres. I can specify a layer, in this case it's going to the default layer. If I wanted to switch to a different layer I could specify that here. I could set the color of the geometry, that's generated. I could do things like add arrowheads, if I'm generating curve geometry lot's of different options. I could also group all of those objects together, which in this case I'd like to do, because I'm going to get a lot of spheres all together. And we can also use our own custom tags with these user text options. But that's a little bit more advanced than what we need right now. So once you've got your options set for baking, just click OK, and your geometry will be converted into actual editable geometry. So, so right now I have both the Grasshopper preview and the Rhino geometry right on top of each other. So just for clarity, let me right-click on the spheres component and disable preview.
So now I have just my Rhino geometry. And in Rhino, I'll switch my view-port shading to shaded. Okay. And I can see I have all of these spheres and I can actually go through and select them as a group. And I can start to make edits if I wanted to resize these or maybe delete some of those, I could do that easily in Rhino. And I can even go to my Grasshopper file and I can close this file and even though that file is gone I still have my geometry in Rhino because I've baked it from Grasshopper into Rhino.
- What is Grasshopper?
- What's an algorithm?
- Setting input data
- Using data matching
- Looking at mathematical and logical functions
- Analyzing curves and surface data
- Working with transformations
- Manipulating the Data Tree