ArcGIS CityEngine for Rhino 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.
CityEngine for Rhino 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.
CityEngine for Rhino 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 CityEngine for Rhino from the market place at food4rhino.
- Start Rhino and open Grasshopper.
- In Grasshopper go to the "Esri" tab and find the "ArcGIS CityEngine" section, drag the "CityEngine" component into the document.
- Right-click on the RPK input parameter to select the "Parthenon" RPK created above. CityEngine for Rhino 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 CityEngine for Rhino will generate the model in the Rhino viewport.
CityEngine for Rhino technically consists of two plugins, (1) a command for Rhino and (2) components for Grasshopper. We expect CityEngine for Rhino 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.
- Windows 10 or 11 (Intel/AMD 64bit).
- Rhino 7.17 (or later) or Rhino 8.8 (or later).
- To author Rule Packages (RPK), a license for CityEngine is needed.
Go to the market place and click on Download, this will download and install CityEngine for Rhino.
See below in the developer documentation.
After starting Grasshopper, the CityEngine for Rhino Grasshopper components are located in the CityEngine
tab.
The main CityEngine for Grasshopper
component is used for generating models, materials and reports out of a CityEngine Rule Package (RPK) and input shapes (polygons, surfaces, meshes). The "bulk" variant is identically in functionality, just provides an alternative way to specify large numbers of parameters (see below). The two helper components CityEngine CGA Reports Unpacker
and CityEngine CGA Reports Display
assist with inspecting and displaying report values generated by the CGA rules.
The CityEngine for Grasshopper
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.
In case building models are pointing "down": CityEngine for Rhino considers the winding order of input polygons. The Rhino Flip
command can be used to correct the orientation of the input polygons.
As the CGA language requires polygon meshes as input, CityEngine for Rhino by default converts all non-mesh input shapes to meshes using the "fast render mesh" settings.
There are multiple ways to control the creation of polygons when converting Breps, Curves, Polylines and Surfaces to Meshes:
- Directly pass the raw converted mesh into CityEngine for Rhino and use the CGA
cleanupGeometry
operation to remove internal edges in the rules. - Use the Rhino commands
AddNgonsToMesh
andDeleteMeshNgons
to control how polygons are grouped together into Ngons within the mesh. - Use the "Ngon" plugin for detailed control of the conversion.
CityEngine for Rhino will recognize the Ngons created by above methods in the input meshes and use them to create the actual input polygon faces for the model generation. In below example, we first used the raw Rhino triangles and quads to run a simple offset-and-extrude rule. Then we used Rhino's AddNgonsToMesh
command to combine some of the quads/triangles to Ngons. CityEngine for Rhino will treat triangles/quads not associated to a Ngon as individual input faces.
To illustrate the use of the "Ngon" plugin, we use the "From Mesh" tool to convert a closed Rhino Curve to a single Ngon and then apply the same simple offset-and-extrude rule:
When both main inputs for RPK and Shapes are connected, the component starts to generate geometry. Initially, the default values for the CGA rule attributes are used. It is possible to override them by adding input parameters to the CityEngine for Rhino component. To do that, zoom on the component until a small +
button appears. Please note, the +
button will only appear if the CGA rule defines any attributes. The "Select Rule Attributes" dialog window opens in which new inputs can be selected from the list of available rule attributes, defined in the rule package currently used. The dialog has tabs for the main rule file and optionally for imports. Each tab has columns for name, data type and default value.
These parameter inputs can then be connected to other Grasshopper components. The context menu also provides an easy way to directly assign a value. CityEngine for Rhino 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 CityEngine for Rhino 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, CityEngine for Rhino 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). CityEngine for Rhino 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. CityEngine for Rhino 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 CityEngine for Rhino
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 CityEngine for Rhino reports helper components.
Each Grasshopper component has an option menu that can be opened by right-clicking on the component name. The CityEngine for Rhino menu contains an additional menu item to toggle the material generation. This is useful to speedup model generation when working with complex scenes.
The CityEngine CGA 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 CityEngine for Rhino
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 Text Tag 3D
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 Text Tag 3D
component.
The Reports
passes through the selected reports for further processing. For example, to unpack them with the CityEngine CGA Reports Unpacker
.
The CityEngine CGA Reports Unpacker
component unpacks the reports data from CityEngine for Rhino
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.
The CityEngine Bulk
component works like the standard CityEngine
component with the difference that all CGA attributes are input with a single (tree) parameter. The below example uses a Panel with "Multiline Data" disabled and each line represents a CGA attribute in the form <name>:<value>
.
A typical use case is to read the CGA attributes from a text file using the File
component (set to "per line"). Note that empty lines are silently ignored.
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. It is currently not possible to change the rule attributes, nor will the command apply materials.
- Windows 10 or 11 (Intel/AMD 64bit)
- Rhino 7 or 8 including Rhino SDK (https://www.rhino3d.com/download)
- Microsoft Visual Studio 2022 or later with MSVC 14.37, MFC for MSVC 14.37 and C# (.NET Framework 4.8 and .NET Core 7.0)
- Optional: Python 3.9 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, foremostCityEngineRhino.rhp
andCityEngineGrasshopper.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 theCityEngineRhino.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
containingCityEngineGrasshopper.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 CityEngine for Rhino 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 RinoCodecs
and CityEngineRhino
C++ project properties. Rebuild and attach the debugger to Rhino and set breakpoints.
- Rebranded from "Puma" to "ArcGIS CityEngine for Rhino and Grasshopper". We will continue to use the compact name "Puma" in the source code.
- Small restructuring of the Grasshopper component toolbar to make it easier to find for new users.
- Renamed the build output to
CityEngineRhino.rhp
,CityEngineGrasshopper.gha
as well asCityEngineRhino.rhi/yak
.
- Improved the new bulk component: added new icon, silently ignore empty input lines for attribute values, warn if lines do not match the key:value pattern.
- Added support for Rhino 8, removed support for Rhino 6.
- Added support for Rule Packages created with CityEngine 2024.0.
- Added a new component where CGA attributes can be input in bulk via a tree parameter.
- Supports Rule Packages from CityEngine 2023.1 and older. Note, the final version 1.2.0 will support CityEngine 2024.0.
- Supports Rhino 6 and 7. Note, Rhino 6 support will be removed in the final version 1.2.0.
- Supports Rule Packages from CityEngine 2023.0 and older.
- Improved the user experience when overriding CGA Rule Attributes.
- Added support for user-created Mesh Ngons in input shapes.
- Corresponds to v0.9.4 with updated documentation.
- Published "Street Segment" example (for Rhino 7) to show-case the main features of 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 CityEngine for Rhino 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 CityEngine for Rhino components. Do not show all possible rule attributes by default to keep the CityEngine for Rhino component compact.
- Added support for rule array attributes.
- Added input parameter to control random generator per CityEngine for Rhino 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.
CityEngine for Rhino 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.
CityEngine for Rhino is under the same license as the included CityEngine SDK. An exception is the CityEngine for Rhino 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 ([email protected]).