Working with the CGA Editor
CityEngine includes a powerful editor for the creation and editing of CGA rules. Whenever a rule file (rule files have the extension *.cga) is opened, it is opened in the CGA editor.
Rule Errors and Warnings
In the picture above, a rule file is open in the CGA Editor; there is a syntax error in the CGA code. The problem is detected automatically and marked red. Note: The position of errors are indicated as small red boxes next to the scrollbar on the right. More detailed information about the error can be found in the Problems view or by hovering the mouse cursor over the red indicators in the CGA editor.
Errors need to be resolved before applying the rules. It is not possible to generate models if the assigned rule file contains errors.
The CGA Editor also issues warnings:
In this case, the rule NewRule is not defined. This is not necessarily a problem. Warnings just indicate potential problems and do not prevent generation.
If your Problems View looks different you might need to configure it.
The CGA Editor features automatic code completion. At any position in the CGA code, you can press <Ctrl + Space> and a window pops up with a number of suggestions which match the current context. Use the cursor keys or the mouse to choose one.
Very important shortcuts for working with the CGA Editor include:
- ctrl+s - save the file (changes must be saved before generation; files with changes are marked with an "*" in the tab)
- ctrl+g - generate (the selected objects, i.e. shapes or models)
- ctrl+F5 - re-generate all models
- ctrl+f - opens "find / search-replace" dialog
- ctrl+l - opens "go to line" dialog
- ctrl+shift+l - shows all shortcuts
Note: These shortcuts only work if the cga editor is the current view (i.e. its tab is highlighted). They might have different meanings in different views!
You can open the Problems View using. On top of Rule Errors (static compile errors), the Problems View also shows Model Errors (dynamic runtime errors), i.e. problems encountered during generation of a model. Such errors and warnings depend on the rule as well as on the initial shape (i.e. its geometry and attributes such as the seed etc.). The Problems view is a great aid in finding and resolving such problems. In the example below a number of buildings were generated and an "asset not found" error was reported.
To find the according model or shape, double-click on the error and the model plus shape will be selected and framed. The picture below shows the inital shape and the generated model for whom the generation resulted in the "asset not found" error.
- Group the errors by their type (i.e. separate Rule Errors and Model Errors):
- Sort the errors by their Location (i.e. by their initial shape):
- Make sure the default limit of 100 markers is disabled:
Copyright ©2008-2018 Esri R&D Center Zurich. All rights reserved.