PyPRT

Python Bindings for the CityEngine SDK

PyPRT provides a Python binding for PRT (Procedural RunTime) of CityEngine. This enables the execution of CityEngine CGA rules within Python. Using PyPRT, the generation of 3D content in Python is greatly simplified.

About PyPRT

Users, such as Python developers, data scientists, or GIS analysts, can efficiently make use of CityEngine Rule Packages (RPK) in order to create 3D geometries stored as Python data structures, or to export these geometries in another format (like OBJ, Scene Layer Package, … ). Given an initial geometry, on which to apply the CGA rule, the 3D generation is procedurally done in Python (Python script, Jupyter Notebook, …). This allows for efficient and customizable geometry generation. For example, when modeling buildings, PyPRT users can easily change the parameters of the generated buildings (like the height or the shape) by changing the values of the CGA rule input attributes.

PyPRT 3D content generation is based on CGA Rule Packages (RPK), which are authored in CityEngine. RPKs contain the CGA rule files that define the shape transformations, as well as supplementary assets. RPK examples can be found below and directly used in PyPRT.

PyPRT allows generating 3D models on multiple initial geometries. Different input attributes can be applied on each of these initial shapes. Moreover, the output 3D geometries can either be used from within Python or exported to another format by using one of the built-in PRT encoders.

PyPRT is free for personal, educational, and non-commercial use. Commercial use requires at least one commercial license of the latest CityEngine version installed in the organization. Redistribution or web service offerings are not allowed unless expressly permitted. Please refer to the licensing section below for more detailed licensing information.

Downloads and Resources

Installation

Simply run pip install pyprt in your desired Python environment or conda install -c esri pyprt in a Conda environment. Then use import pyprt in your scripts.

→ Installation instructions

Documentation

A full documentation of PyPRT is available on our github repository.

→ Read documentation

Github

For more information, assets and resources check our Github repository.

→ Go to Github

Examples

3D Model Optimization

This example tries to answer the following question: given the architectural design of a building (defined by a CGA rule) and a parcel, which values for the building parameters should we choose in order to maximize the green potential of the building?

Link to the example notebook ArcGIS Notebooks and PyPRT (Instruction)

3D GIS Content Creation

This example presents a possible workflow consisting of collecting and selecting city parcels, and populating them with procedurally generated trees. To do so, PyPRT is used in combination with other Python libraries, e.g. the ArcGIS API for Python.

Link to the example notebook ArcGIS Notebooks and PyPRT (Instruction)

Other Examples and blog entries

Other examples of PyPRT usage are located in the pyprt-examples Github repo. Ready-to-use rule packages and initial shapes are available there.

More Examples Generating 3D content in Python: PyPRT, a new Python library Converting 3D geometry formats made simple using PyPRT

ArcGIS Blog

Read articles from the CityEngine team.

Go to the blog

What's New

Discover recently added capabilities of CityEngine.

See what's new

Resources

Build expertise and connect with the CityEngine community

Build expertise

Community

Share experiences and learn tricks from the CityEngine community.

Join the conversation