CGA (Computer Graphic Architecture) is the unique programming language for ArcGIS CityEngine that you can specify to generate 3D content for urban planning. Use the CGA Editor windows to create and modify CGA rules that are applied to shapes to create 3D geometry and architecture.
In the CGA Editor window , you can write, modify, and save CGA rules. To edit a CGA rule, do the following:
- Open the CGA rule file.
- 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.
- Make necessary edits.
- Press Ctrl+S to save the CGA rule file or click File > Save in the main menu.
- 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.
The position of an error is indicated by a small red box next to the scrollbar on the right. More detailed information about the error can be found 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. It is not possible to generate models if the assigned rule file contains errors.
The CGA Editor window also issues warnings:
In this case, the rule NewRule is not defined. This is not necessarily a problem. Warnings indicate potential problems but still allow generation.
You can open the Problems window using Window > Show Problems. On top of 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 (in other words, its geometry and attributes such as the seed, and so on). The Problems view allows you to find and resolve such problems. In the example below, a number of buildings were generated and an "asset not found" error was returned.
To find the according model or shape, double-click the error, and the model plus shape will be selected and framed. The picture below shows the initial shape and the generated model in which the generation resulted in the "asset not found" error.
The Problems window can be configured according to your taste and needs. Here are the recommended settings:
- Right-click in the Problems window and select Group By > Type to group the errors by their type (in other words, separate Rule Errors and Model Errors):
- Click Location to sort the errors by Location (in other words, by their initial shape).
- Right-click and select Configure Contents.
- Deselect Use item limits to disable the default limit of 100 markers.
The CGA Editor window features automatic code completion. At any position in the CGA code, you can press Ctrl+Spacebar and a pop-up appears with a suggestions that match the current context. Use the cursor keys or the mouse to choose one.
Keyboard shortcuts for working with the CGA Editor window include the following:
- 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, in other words, shapes or models).
- Ctrl+F5—Re-generate all models.
- Ctrl+F—Opens the Find / search-replace dialog box.
- Ctrl+L —Opens the Go to line dialog box.
- Ctrl+Shift+L—Shows all shortcuts.
These shortcuts only work if the CGA Editor window is the current view (in other words, its tab is highlighted).