What Function Is Being Called When You "Right Click Bake" GH Component?


I’m working with Model Views in Rhino 8 and while they do not work with the new “Bake Content” component nor do they work with Elefront or other baking components, if I manually right click on the component and choose “Bake”->Hit Enter it bakes the Model Views to my Named Views list in Rhino as I expect.

How can I automate this functionality via scripting? There has been talk for a bit that the bake component will be able to handle Model Views but I need a solution sooner.

Can anyone point me in the direction of what method or function is being called when you right click and choose bake on a component? I should be able to take it from there…

If it matters to anyone the script input is of type Rhino.DocObjects.ViewportInfo

Thank you so much!


“Baking” probably translates to casting Grasshopper geometry types to Rhino ones and adding them to the object pool of the current Rhino document.

Here’s a Pythonic example, meaning how to “bake” from GHPython to Rhino:

import Rhino as rc
import scriptcontext as sc

# Set the context to the active Rhino document
sc.doc = rc.RhinoDoc.ActiveDoc

# Add a circle to the object pool of the active document
circle = rc.Geometry.Circle(1.0)  # create a circle of radius 1
sc.doc.Objects.AddCircle(circle)  # bake the circle


# Set the context back to Grasshopper
sc.doc = ghdoc
1 Like

Thanks @diff-arch, while I did start exploring these methods you’ve outlined I am having issues “baking” Views in particular.

I guess with what you are saying when I go to right click on a component and choose Bake… It is running methods specific to that geometry type or node. Would that be correct? So if it’s a Cone component it’s adding a brep to the document, if it’s a Text Dot it’s a Rhino Text Dot object and the associated logic for that. But there isn’t a generic “bake” method that I can invoke on any object type correct?

I can’t seem to get the Model Views to bake to the Rhino Document. I’ve successfully created new Named Views with the names of the Model Views and I have all the info I need to supply to the Named Views such as Camera Location, Camera Target, etc.

So my next step was thinking about taking that info and creating new Views with that data as input parameters.

However, since all of that data lives in the Rhino 8 Model View component already I was hoping to just bake the Model View node directly. If I right click bake it works just fine, but I need to expose a boolean toggle so that I can create the views dynamically instead of manually clicking bake each time the views change.

@AndyPayne do you happen to know what is being called when you right click and choose Bake… On the Model View component?

Any leads are greatly appreciated, thank you!

here’s the related older post about the views specifically

It’s hard to tell, but my guess is that it works at least in a similar fashion.

In the case of views, I’m inexperienced in terms of scripting, but you can access the camera of the active view, like so:


I believe these are get and set properties, meaning you can read the location and/or direction information and change it as well.

The rest here is speculative, but if you are dealing with a custom, created view the same should apply. You can probably add a view with sc.doc.Views.Add(self: ViewTable, title: str, projection: DefinedViewportProjection, position: Rectangle, floating: bool) -> RhinoView and then manipulate it’s properties, like the camera and so on?