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.
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.
Note:
- The CGA Editor window
has syntax highlighting for better readability of the code. - The CGA Editor window
detects syntax errors and highlights them with a white X on a red background. Click Window > Show Problems in the main menu for a list of syntax errors. - Press Ctrl+Spacebar when typing to complete a command.
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.
Code completion
The CGA Editor window
includes automatic code completion. At any position in the CGA code, you can press Ctrl+Spacebar on your keyboard and a pop-up appears with a suggestions that match the current context. Use the arrow keys or other cursor keys or the mouse to choose one.
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.
Note:
These shortcuts only work if the CGA Editor window
is the current view (its tab is highlighted).