Working with the CGA Editor
The 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 (line 195: "->" instead of "-->"). 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 error icon on the left:
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 WallsDone 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!
Problems ViewOn 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 / 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 two "asset not found warnings" were reported. To find the according model/shape, double-click on the warning 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 "Could not load asset cube_bevel1_side.obj - file not found." warning.
- 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-2016 Esri R&D Center Zurich. All rights reserved.