Python Scripting

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:

Python Scripting Documentation:

  1. Python Developmental Environment
    1. Parameters and Attributes
    2. Settings classes
    3. Script-based Export
    4. Special scripts
    5. Working with Python 3
  2. Commands by Category
  3. Command Reference
  4. Notes and Changelog