Puma is a plugin for Rhino3D and Grasshopper. It provides a Rhino command and Grasshopper components which enable the execution of CityEngine ‘rules’ within a Rhino scene. Therefore, a Rhino artist or designer does not have to leave their familiar Rhino environment anymore to make use of CityEngine’s procedural modeling power. Complicated export-import steps are no longer needed, which also means that the procedural models do not need to be “baked” anymore. The building or street models stay procedural during the entire design or planning workflow. Consequently, the user can change any attributes of the building or street models easily by connecting them to other Grasshopper components.
Puma requires so-called rule packages (RPK) as input, which are authored in CityEngine. An RPK includes assets and a CGA rule file which encodes an architectural style. Comprehensive RPK examples are available below.
Puma is free for personal, educational, and non-commercial use. Commercial use requires at least one commercial license of the latest CityEngine version installed in the organization. Redistribution or web service offerings are not allowed unless expressly permitted.
Download and open the "Street Segment" example or create a scene from scratch:
- In CityEngine, download e.g. Tutorial 9 and export the "Parthenon" CGA rules to a RPK (see Creating a Rule Package).
- Install Puma from the Puma market place at food4rhino.
- Start Rhino and open Grasshopper.
- In Grasshopper go to the "Esri" tab and find the "Puma" section, drag the Puma component into the document.
- Right-click on the RPK input parameter to select the "Parthenon" RPK created above. Puma will ask you to save the document, so it can store the path to the RPK relative to the document. It is best practice to put RPKs next to the Grasshopper document or in a subdirectory.
- Create a "Surface" component and use the "Set one surface" context menu entry to draw a surface in Rhino with the "Surface from 3 or 4 corner points" tool.
- Connect the "Surface" to the "Shapes" input. Now Puma will generate the model in the Rhino viewport.
Puma technically consists of two plugins, (1) a command for Rhino and (2) components for Grasshopper. We expect Puma to be used mainly through Grasshopper as only there its full potential can be used by connecting it to other Grasshopper components. The lower-level Rhino command ApplyRulePackage
is useful to one-off test CityEngine Rule Packages.
Note: Puma is currently only available for Windows 10 (Intel/AMD 64bit).
Go to the Puma market place and click on Download, this will download and install Puma.
See below in the developer documentation.
After starting Grasshopper, the Puma components are located in the Esri
section in the Special
tab.
The main Puma
component is used for generating models, materials and reports out of a CityEngine Rule Package (RPK) and input shapes (polygons, surfaces, meshes). The two helper components Puma Reports Unpacker
and Puma Reports Display
assist with inspecting and displaying report values generated by the CGA rules.
The main Puma
component has two fixed inputs. The RPK
input takes a file path from a CityEngine Rule Package file (.rpk). The second input Shape(s)
takes one or more input geometries (Mesh, Rectangle, Brep, Surface).
Any Grasshopper component providing such objects can be connected to the Shape(s)
input, for example the Rectangle
component. The steps how to define a Rectangle
input are:
- Create a
Rectangle
component - Right-click on the
Rectangle
component and chooseSet one Rectangle
orSet Multiple Rectangles
. - Draw the rectangle(s) in the Rhino viewport using the Rhino
Rectangle
tool. - Select the rectangle.
Note that there are slight differences in these steps based on the geometry type. The Surface
component, for example, does not allow you to draw a shape, but only to select a previously existing one. It is needed to draw it first using Rhino tools.
When both main inputs are connected, the component is solved a first time. The default values for the cga rule attributes are used. It is possible to override them by adding input parameters to the Puma component. To do that, zoom on the component until a small +
button appears. It opens a dialog window in which new inputs can be selected from the list of available rule attributes, defined in the rule package currently used.
These parameters can then be connected to other components. The context menu also provides an easy way to directly assign a value. Puma will use default values for unconnected inputs which are defined in the rules and in general also depend on the input shapes.
Rule attributes and the corresponding Puma component inputs use four basic data types: (1) Number, (2) String, (3) Boolean (Toggle) and (4) Colour. These can be either single values or lists of values. In case of lists and length mismatches, Puma will either truncate lists or repeat the last value of a list until the length of the shape(s)
input is matched.
Please note that string attributes representing assets like .obj
or texture files can only refer to files within the current Rule Package (RPK). Puma will interpret the string as a file path (with forward slashes as separator) relative to the RPK root, e.g. assets/my_asset.obj
. In case of unexpected behavior, it can be useful to inspect the RPK in question with a tool like 7zip
to confirm the presence of asset files.
The inputs are typically created by these built-in Grasshopper components:
- Number(s):
Number
andNumber Slider
- String(s):
Panel
andText
- Boolean(s):
Bool
andToggle
- Color(s):
Colour
,Colour Picker
andSwatch
To get more information on each rule attribute input, the user can hover with the mouse over each of them. A tooltip is displayed, containing information on the expected data. Puma will read the CGA annotations on the rule attributes and display metadata such as the allowed range for numbers.
If the CGA rule attribute is annotated as an enumeration the tooltips will list the range of values.
It is possible to automatically create connected input components by using the Extract Parameter
feature. Right-click on the input parameter you want to extract and select Extract parameter
. The new component will display the same name and description as the input parameter, and have the attribute's default value(s) assigned to it.
The Puma
component has five outputs:
- Models: The generated meshes.
- Materials: The generated materials
- Reports: The generated cga reports.
- Prints: The messages defined in the cga rule.
- Errors: The errors encountered during the generation process.
The Models
output will contain for each input shape a list of meshes (one mesh per material). The generated materials can be applied to the meshes by connecting the built-in Custom Preview
component. The reports are output as a custom data type which can be displayed and converted with the Puma reports helper components.
Each Grasshopper component has an option menu that can be opened by right-clicking on the component name. The Puma menu contains an additional menu item to toggle the material generation. This is useful to speedup model generation when working with complex scenes.
The Puma Reports Display
is designed to help display CGA report values in the Rhino viewport and takes 5 inputs. The first two are typically connected to the respective outputs of the main Puma
component. The next three inputs are optional filters:
Shape ID Filter
: Used to filter the reports by initial shape ID. Accepts a Domain component.Report Key Filter
: Filters the reports by key name. Accepts aPanel
orText
component, or a list of them. Report keys can be written on multiple lines.Report Value Filter
: This input allows to select specific values for each keys selected in theReport Key Filter
input.
This component has three outputs, the first two can be connected to a 3D Text Tag
component to display the selected reports in the Rhino viewport. The Reports Location
output provides the location to position and align the reports text above each generated model. The Reports Display
output provides the formatted reports text.
Here is an example of reports displayed in the Rhino
viewport using the 3D Text Tag
component.
The Reports
passes through the selected reports for further processing. For example, to unpack them with the Puma Reports Unpacker
.
The Puma Reports Unpacker
component unpacks the reports data from Puma
into lists of shape index, report name and report value. This is typically used to further process the reports with built-in Grasshopper components, e.g. to write the reports to a text file.
In Rhino, select a shape and type the command ApplyRulePackage
in the command line. This will open a file dialog to choose a RPK file. After confirming, the models will be generated on the selected shape.
Please note, this command is only meant to provide a quick way for testing a RPK on a shape and it is currently not possible to change the rule attributes.
- Windows 10 (Intel/AMD 64bit)
- Rhino 6 or 7 (https://www.rhino3d.com/download)
- Microsoft Visual Studio 2019 with MSVC 14.27, MFC for MSVC 14.27 and C# (.NET Framework 4.5.2)
- Optional: Python 3.7 or later
- Install the tools from the Software Requirements section.
- Follow the instructions from the Rhino documentation to install the Rhino SDK and related tools.
- Follow the instructions from the Rhino documentation to install the Grasshopper SDK.
- Checkout this Git repository.
- Open the Visual Studio solution.
- Ensure the configuration is set to
Release
andx64
(the only supported configuration). - Build the solution. The result is stored in the
build
directory, foremostPumaRhino.rhp
andPumaGrasshopper.gha
.
After having built the plugins, they have to be installed in Rhino and Grasshopper respectively.
- Start Rhino. In the menu bar, go to Tools -> Options -> Rhino Options -> Plug-ins.
- Click on
install
and select thePumaRhino.rhp
file located inpath-to-solution/build
. - To install the Grasshopper plugin, run the command
GrasshopperDeveloperSettings
in Rhino. - In the window that opens, add the folder
path-to-solution/build
containingPumaGrasshopper.gha
. Make sure theMemory load .gha assemblies...
box is unticked. - Confirm, then restart Rhino and Grasshopper.
Once both plugins (rhp
for Rhino, gha
for Grasshopper) are built, it is possible to create a rhi
(Rhino Installer) package and/or a yak
package using the create_package.py
python script. A rhi
package is simply a zip archive containing all files required to run a plugin. If Rhino is installed, the plugin can be installed by double-clicking the package. It will extract the files and Rhino/Grasshopper will load them when started. The yak
package is the archive that can be uploaded to the Rhino marketplace in order to publish the plug-in.
- Open a console, navigate to the Puma solution directory and run the command
python create_package.py <option>
. Valid values for<option>
areboth
(default),rhi
, oryak
to choose which package type to build. - The resulting
rhi
andyak
packages will be created in a folder namedpackages
located in the solution root directory.
- Close Rhino if it is open.
- Run the
rhi
package by double-clicking it. - The package installer will open. Follow the instructions.
- The plugin will be loaded at the next start of Rhino/Grasshopper.
Note: In case of troubles, try to enable the "Ask to load disabled plug-ins" box located in Rhino's Tools -> Options -> Plug-ins.
For debugging, keep the Release
configuration (we always generate PDBs) and turn off the C++ optimizations in the PumaCodecs and PumaRhino C++ project properties. Rebuild and attach the debugger to Rhino and set breakpoints.
- Corresponds to v0.9.4 with updated documentation.
- Published "Street Segment" example (for Rhino 7) to show-case the main features of Puma.
- Puma supports Rhino 6 and 7.
- Supports Rule Packages from CityEngine 2021.1 and older.
- Limitation: no support yet for PBR materials in Rhino 7.
- Public Beta.
- Updated to PRT 2.5: Supports Rule Packages (RPK) from CityEngine 2021.1 and older.
- Fixed use of wrong rule attribute values in a GH document with multiple Puma nodes.
- Fixed group assignment of extracted parameters.
- Supports Rhino 6 and 7.
- Internal test build.
- Supports Rhino 6 and 7.
- Supports Rule Packages from CityEngine 2021.0 and older.
- Improved portability of Grasshopper documents by storing relative paths to Rule Packages (introduces a "RPK" custom parameter).
- Detect external modification of Rule Packages and potentially reload them when solving the Grasshopper document.
- Correctly keep manually set parameter values when internalizing a parameter.
- Fixed parameter extraction of rule attributes after loading a Grasshopper document.
- Fixed handling of polygons with holes.
- Various code cleanups.
- Internal test build.
- Supports Rhino 6 and 7.
- Supports Rule Packages from CityEngine 2021.0 and older.
- Improved conversion of non-Mesh input shapes. Rhino Rectangles now have a consistent winding order.
- Optimized loading performance of large Rule Packages with many textures.
- Improved "extract parameter" behavior for rule attributes. This includes support for array attributes and using dedicated components (e.g. toggles and sliders) for single value attributes.
- Internal test build.
- Supports Rhino 6 and 7.
- Supports Rule Packages from CityEngine 2021.0 and older.
- Optimized model generation to distribute input shapes across all CPU cores.
- Improved attribute sorting in chooser dialog to match the CityEngine inspector as close as possible.
- Internal test build.
- Supports Rhino 6 and 7.
- Supports Rule Packages from CityEngine 2021.0 and older.
- Supports multiple input shapes with different rule attribute values.
- Switched to dynamic input parameters for the rule attributes on the Puma components. Do not show all possible rule attributes by default to keep the Puma component compact.
- Added support for rule array attributes.
- Added input parameter to control random generator per Puma component.
- Added output parameters for CGA print and asset error/warning outputs.
- Added support for creating
yak
packages. - Added initial manual.
- Internal test build.
- Supports Rhino 6.
- Supports Rule Packages from CityEngine 2020.0 and older.
- Supports multiple input shapes with same rule attributes.
- Added Grasshopper helper components to process and display CGA report values.
- Development: Added support for creating
rhi
packages.
- First internal proof of concept.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
Puma is free for personal, educational, and non-commercial use. Commercial use requires at least one commercial license of the latest CityEngine version installed in the organization. Redistribution or web service offerings are not allowed unless expressly permitted.
Puma is under the same license as the included CityEngine SDK. An exception is the Puma source code (without CityEngine SDK, binaries, or object code), which is licensed under the Apache License, Version 2.0 (the “License”); you may not use this work except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.
For questions or enquiries, please contact the Esri CityEngine team (cityengine-info@esri.com).