[019] How to Generate Real-Time Building Reports in CityEngine Using CGA
Extract + Real-Time Data + Procedural Modeling Metrics
Learn how to use the report command in Esri CityEngine to extract live statistical data such as floor counts, total floor area, and land-use metrics directly from your procedural models.
When working on complex urban models in Esri CityEngine, you might have wondered: "Is it possible to get statistics on the number of buildings, the area per land use, or the total count of windows in real time?"
The answer is yes. By using the report command in your CGA rules, you can display live information in the Reports tab of the Inspector panel. This data can then be easily copied into a spreadsheet for detailed analysis and reporting.
The Core Concept of the Report Command
The fundamental idea behind the report function is to instruct CityEngine to record specific information at a chosen stage of your rule hierarchy. Even if you are a beginner at CGA, you will find this command easy to implement as you progress in your coding journey.
In the following example, we will create a simple building rule that automatically tracks floor count and gross floor area during model generation.
Let's start with a simple example: extracting information about the number of floors and the Gross Floor Area (GFA).
@Range(min=1, max=10, stepsize=1)
attr floor = 1
Lot --> extrude(floor * 3) BD
BD --> split(y) { ~3: Floor }*
Floor -->
report("Floor Count", 1)
report("Gross Floor Area", geometry.area())
X.
Rule Explanation:
-
The model extrudes the Lot based on the
floorattribute and then splits the volume into 3-meter segments. -
Every time the
Floorrule is triggered, the report command adds 1 to the "Floor Count." -
It also calculates the current polygon's area using
geometry.area()and adds it to the "Gross Floor Area" total. - The geometry.area() function returns the current polygon surface area being processed by the rule.
As you adjust the attributes in the Inspector panel, these values will update instantly. Watch the video below to see how the reports respond to real-time changes.
Generated values appear inside the Reports tab located in the Inspector panel.
Grouping Statistics by Land Use
For more advanced urban planning scenarios, you might need to categorize statistics by land use. By using string concatenation in the report label, you can generate grouped data automatically.
@Range(min=1, max=10, stepsize=1)
attr floor = 1
attr Landuse = "Residential" # Example attribute
Lot -->
report("Building Count." + Landuse, 1)
report("Footprint Area." + Landuse, geometry.area())
extrude(floor * 3) BD
BD --> split(y) { 3: Floor }*
Floor -->
report("Floor Count." + Landuse, 1)
report("Total Area." + Landuse, geometry.area())
X.
In this example, the statistics are appended with the value of the
Landuse attribute. If you have multiple buildings with different
land uses selected, CityEngine will aggregate the data for each category
separately. This allows you to quickly see the total area for "Commercial"
versus "Residential" zones.
While numerical reports are powerful for precision, they can sometimes be difficult to interpret visually. To address this, CityEngine Dashboard tools allow procedural report data to be visualized as charts, graphs, and live analytics dashboards.
In the next lesson, we will learn how to visualize this data effectively.
- Convert models to shapes and fix image distortions in [018] Convert Models to Shapes and Fix Perspective Distortion in CityEngine
- Visualize your report data with dynamic charts in [020] How to Create Dashboard Charts from Report Data in CityEngine
- Understand procedural hierarchy concepts through [006] Understanding the Basic Concepts of Procedural Modeling
- Learn workflow fundamentals before coding with [017] Why Understanding Workflow Matters Before Learning CGA
- Explore adjustable building parameters in [005] Create Adjustable 3D Building Models
Comments
Post a Comment
Feel free to leave a comment if you have any questions about Global Mapper or CityEngine. I will get back to you with a sincere response as soon as possible. (Please note that all comments are moderated and manually approved to maintain a high-quality community. Promotional or spam content will not be published.)