Computer Graphic Architecture (CGA) is the unique programming language for ArcGIS CityEngine that you can specify to generate 3D content for urban planning. Use the CGA Editor window
to create and modify CGA rules that are applied to shapes to create 3D geometry and architecture.
Create a CGA rule file
Open the wizard dialog by doing one of the following:
- In the Navigator window, right-click any folder and select New > CGA Rule File.
- On the main menu, click File > New (Ctrl+N) > CityEngine > CGA Rule File.
Choose a destination folder and file name and click Finish.
Edit a CGA rule
To edit a CGA rule, complete the following steps:
- Open the CGA rule file by doing one of the following:
- Double-click the rule file in the Navigator window
. - Click Rule File in the Inspector window
if the selected object has a rule file assigned to it.
- Double-click the rule file in the Navigator window
- Make the necessary edits.
- Press Ctrl+S or click File > Save in the main menu to save the CGA rule file.
Code completion
The CGA Editor window
includes automatic code completion to assist you while writing CGA rules. Context sensitive proposals appear automatically as you type. You can also press Ctrl+Space at any position to manually trigger code completion. A pop-up appears with suggestions that match the current context. Use the arrow keys or the mouse to choose one.
You can enable or disable the automatic code completion in the preferences under Edit > Preferences > CGA Editor or you can right-click inside the editor and click Preferences from the context menu.
Code documentation on hover
The CGA Editor window
provides code documentation on hover, displaying contextual information for CGA functions, operators, and attributes. When hovering over a CGA element, a pop-up shows the corresponding CGA reference documentation, including valid syntax, parameters, and a short description.
You can enable or disable the code documentation on hover in the preferences under Edit > Preferences > CGA Editor.
Keyboard shortcuts
The following keyboard shortcuts can be used in the CGA Editor window
:
- Ctrl+S—Save the file (changes must be saved before generation; files with changes are marked with an asterisk (*) on the tab).
- Ctrl+G—Generate the selected objects (shapes or models).
- Ctrl+F5—Regenerate all models.
- Ctrl+F—Open the Find search-replace dialog box.
- Ctrl+L—Open the Go to line dialog box.
- Ctrl+Shift+L—Show all shortcuts.
- Ctrl+Space—Trigger code completion.
Note:
These shortcuts only work if the CGA Editor window
is the current view (its tab is highlighted).
Manage rule errors and warnings
The syntax error in the CGA code is detected automatically and marked red.

Note:
The position of an error is indicated by a small red box next to the scrollbar on the side. More detailed information about the error is available in the Problems window
or by hovering over the red indicators or error markers in the CGA Editor window
.
Errors must be resolved before applying the rules. You cannot generate models if the assigned rule file contains errors.
The CGA Editor window
also issues warnings:

In the image above, the NewRule rule is not defined. This is not necessarily a problem. Warnings indicate potential problems but still allow generation.
Problems window
To open the Problems window
, click Window > Show Problems. In addition to rule errors (static compile errors), the Problems window
also shows model errors (dynamic runtime errors), in other words, problems encountered during generation of a model. Such errors and warnings depend on the rule as well as on the initial shape (its geometry and attributes such as the seed, and so on). The Problems window allows you to find and resolve these types of problems. In the image below, a number of buildings were generated and an asset not found error was returned.

To find the related model or shape, double-click the error, and the model and the shape are selected and framed. The image below shows the initial shape and the generated model in which the generation resulted in the asset not found error.

Configuration
You can configure the Problems window
as necessary. The following are the recommended settings:
- Right-click in the Problems window
, and click Group By > Type to group the errors by their type (separate Rule Errors and Model Errors). - Click Location to sort the errors by location (by their initial shape).
- Right-click and click Configure Contents.
- Uncheck Use item limits to disable the default limit of 100 markers.