Python scripting in CityEngine consists of two major parts:
- Python API: it is designed to help implement custom solutions and automate CityEngine. The API contains functionality to edit scene data, work with CGA, automate data import/export, control the UI and more.
- Python development environment (IDE): it provides a Python editor, an interactive Python console and runs Python code.
The Python API is available for multiple Python versions:
- Jython 2.7
- Python 3.x
For Jython 2.7, the API module is called "scripting" and for Python 3.x, the API module is called "cityengine".
The Python 3 API and IDE is currently in Beta and has known limitations.
CityEngine by default ships with a Jython 2.7 and a Python 3.11 interpreter. On Windows, Python 3.11 is bundled with the installation. On Linux, CityEngine looks in the system path for Python 3.11 (with a fallback to any Python 3.x).
The main differences between Jython and Python are:
- Language and syntax changes from Python 2 to 3. See the official Python docs for details (for example, note the different "print" syntax).
- The Python 3 interpreter comes with support for the "pip" package manager (manual) and virtual environments. This makes the Python 3 API compatible with 3rd-party packages available from repositories like pypi.org, e.g. with ArcGIS Pro ArcPy or the ArcGIS API for Python.
Python Scripting Documentation: