For AECTech (NY 2024, London 2025) and Shape2Fabrication (London 2025) workshops, we worked on creating a brush command for Rhino that can ‘paint’ the height (vertical scale) of buildings (extrusion objects) or angle of triangular-shaped panels generated in Grasshopper. I have been getting requests to share the files so here they are. These scripts can be easily modified to apply brush-like modification to other properties of an object.
Command
The script below is for Paint Heights command in Rhino. You can download either the Python or C# version of this script and run in Rhino 8 script editor. The test model is also attached. Here is how the script should work:
- Download either C# Script (PaintHeights.cs) OR Python Script (PaintHeights.py)
- Download and open Rhino model (PaintHeights.3dm)
- Open script in ScriptEditor
- Run the script
- Select the white background plane of the city (this is where the brush is drawn)
- Click and paint over the buildings
- Hold Shift to push the heights back down
Component
There is an slightly more complicated iteration of this script as a Grasshopper 1 script component named Paint Angles. The component can provide painted values for a series of input points. The brush head will snap to given input mesh (a simple Delaunay of input points in this example). Painted values (per point) are sent to values
output and used in applying a rotation to triangle panels. The painting action is triggered from context menu of the component and should behave like this:
- Open Rhino model (PaintAngles.3dm)
- Open Grasshopper 1 definition (PaintAngles.gh)
- Grasshopper should generated and preview the triangle grid
- Right-Click on the script component and choose Paint
- Click and paint over the triangles
- The script component surgically expires the downstream components and recomputes Grasshopper 1 definition updating the panel previews.
- Right-click on the script component and choose Reset Cache to reset the paint cache and set all output values to zero.
- Hold Shift to rotate panels back
Notes
- These scripts are designed to showcase scripting in Rhino 8 for the workshops. Do not use in production. I am sure there are a billion better ways to write them.
- Both command and component brush have configurations for Size, Falloff, and Strength of the brush. Inputs are not bound-checked nor validated.
- Both command and component scripts use EasingFunctions NuGet package for easing of brush head strength. This is mostly to showcase using external packages in the new script editor. Easing curves are fairly trivial to write otherwise so this dependency can be easily removed.
- Brush script sets
FullFrameRedrawDuringGet = true;
otherwise Grasshopper previews are not drawn during brush paint operation.
Brush Project
Towards the end of the workshop, we put the command and component into a script editor project and separated the core brush functions into a C# library:
BrushProject.zip (30.8 KB)
Further Reading
To learn more about scripting in Rhino 8 see the Scripting documents, especially Creating and Publishing Rhino/Grasshopper Script Plugins