CGA Editor

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 CGA Editor 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:

  1. Open the CGA rule file by doing one of the following:
    • Double-click the rule file in the Navigator window Navigator.
    • Click Rule File in the Inspector window Inspector if the selected object has a rule file assigned to it.
  2. Make the necessary edits.
  3. Press Ctrl+S or click File > Save in the main menu to save the CGA rule file.
Note:
  • The CGA Editor window CGA Editor has syntax highlighting for better readability of the code.
  • The CGA Editor window CGA Editor 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.

Rule file with syntax error
A rule file with a syntax error is shown.

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 Problems or by hovering over the red indicators or error markers in the CGA Editor window CGA Editor.

Errors must be resolved before applying the rules. You cannot generate models if the assigned rule file contains errors.

The CGA Editor window CGA Editor also issues warnings:

Rule file not defined
An undefined rule file warning is shown.

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 Problems, click Window > Show Problems. In addition to rule errors (static compile errors), the Problems window Problems 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.

Model error
A model error is shown.

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.

Asset not found error
An asset not found error is shown.

Configuration

You can configure the Problems window Problems as necessary. The following are the recommended settings:

  • Right-click in the Problems window Problems, 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 CGA Editor 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 CGA Editor:

  • 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 CGA Editor is the current view (its tab is highlighted).