From the course: Grasshopper and Rhino: Python Scripting

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Accessing the Rhino document

Accessing the Rhino document

From the course: Grasshopper and Rhino: Python Scripting

Start my 1-month free trial

Accessing the Rhino document

- [Instructor] Geometry generated in Grasshopper is eventually baked and stored within a Rhino file. Using Python, we're able to bake geometry and assign attributes including layout and object colors. In order to do this, we need to be able to access the Rhino document we're working in, and make some changes. This is done through a few different namespaces. The first is the Rhino.DocObjects namespace, within here is where we can find all the object types, that are found in the document, so classes for breps, curves, and dimensions for example. These types differ to the types we've been working with in the Rhino.Geometry namespace, in that they have attributes attached to them such as color, layer, and reference to the underlying geometry types that make them. So in order to bake, we first need to create an attributes object and set it's properties such as color and layer, and then add our geometry to the document along with these attributes. So by accessing this namespace, we can…

Contents