Skip to content

Choosing the Right Programming Tools in CityEngine

November 26, 2013

In last week’s post on data driven visualization using CityEngine I showed that the results required using a variety of programming tools and techniques. No one programming environment or tool – traditional ArcGIS, CityEngine’s native “Computer Generated Architecture (CGA)” shape grammar, or direct Python scripting in CityEngine – was sufficient to accomplish all the tasks required. Ultimately, data-driven visualization requires a developer to be fleet of foot, recognizing which tool applies when, and implementing each to its best advantage.

GIS information is imported as shape layers.  This layer shows the lots that have been identified as underutilized.  On the right hand edge the object attributes panel shows additional GIS annotations for one particular lot that has been imported along with its shape.

GIS information is imported as shape layers. This layer shows the lots that have been identified as underutilized. On the right hand edge the object attributes panel shows additional GIS annotations for one particular lot that has been imported along with its shape.

ArcGIS is very powerful at manipulating the 2D geometry up front and then importing that data as annotated shapes into the CityEngine environment. Furthermore, Portland Metro has GIS experts more than ready to manipulate data by hand much more quickly than I can turn it into a stable program. Of course the goal was to see how far we could automate and replicate the process, so minimizing our dependency on manual processing was important as well.

Python programming creates routines using traditional imperative or functional programming techniques. The "Redevelop Routine" maps itself to the individual lots in a list, demolishes the existing buildings on a lot, and generates new building models based on its development type.

Python programming creates routines using traditional imperative or functional programming techniques. The “Redevelop Routine” maps itself to the individual lots in a list, demolishes the existing buildings on a lot, and generates new building models based on its development type.

CityEngine’s Python environment is sparse. There is little geometry support, so even determining simple relationships between shapes takes extra time to get right. Importing a good third-party geometry package will help greatly in future work. Debugging support is minimal. I found it frustrating to repeatedly track down small syntax errors by commenting out large chunks of code and adding them back in bit by bit. Ultimately my routines were filled with print statements saying “You made it to here!” But Python gives the ultimate flexibility. While I find indentation as syntax crudely reminiscent of Fortran and punch cards, Python’s list handling and comprehensions are elegant and fun to work. They are also tailor-made for manipulating the large sets of geometry shapes. Python also allows me to import and utilize outside file based data sources such as the comma-separated-value files I used to map development types to  building types. This is an important feature as it allows a future non-programmer to adjust and iterate through different data configurations without having to hack the code at each step.

This images shows a CGA rule file on the left hand side.

This images shows a CGA rule file on the left hand side.

Finally, CityEngine’s CGA shape grammar is by far the best environment for creating iconic shapes used to represent building types.  CGA rules also provide slick mechanisms for recursively processing shapes and selecting alternative rules based on percentage probabilities, which are not easily implemented in Python.

Advertisements
2 Comments leave one →
  1. December 17, 2013 7:57 am

    Reblogged this on ARCHITAMENT.

Trackbacks

  1. 软件Esri CityEngine | 17

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: