[038] How to Select Street-Facing Faces with Comp() in CityEngine
Learn how to target street-facing faces using street selectors and handle streetWidth attributes in imported GIS data.
This tutorial explains how to use street selectors in CityEngine. They define front, back, and side faces relative to streets. We cover the essential requirement of the streetWidth attribute and how CityEngine handles geometry when these attributes are missing or imported from external CAD data.
In real-world GIS workflows, these selectors become especially important when working with imported parcel data.
The face adjacent to the road is defined as 'front'. When looking at the shape from the road, the left side is 'left', the right side is 'right', and the back is 'back'. The combination of left and right is referred to as 'side'.
Mandatory Requirement: The streetWidth Attribute
A specific condition is required to use the street selector. As stated in the reference, the shape can be assigned the StreetWidth attribute. (We covered this in [014] How to Use First Edge & Street Edge Attributes in Esri CityEngine and [015-016] Compute First/Street Edges and Edge Attributes in Esri CityEngine)
Handling Blocks with Missing Attributes
In other words, if the block was not created using CityEngine's street creation tool, you must manually assign the street attributes. Let's look at how a block is created using the street creation tool.
CityEngine street creation tool.
Dynamic Parcel Generation Logic
The moment a closed polygon is formed, a parcel is created inside. Parcels are not created for open polygons.
The Lot generated in this manner automatically receives the streetWidth attribute, as shown in the figure below.
The problem is that we rarely divide parcels in this exact way. Because these are parcels created by CityEngine's default algorithm, they are often difficult to apply directly in professional practice.
Even if you select the Block in the Inspector panel and change the Subdivision Type, the core limitation remains similar.
You can see the differences by changing the area or other options.
Ultimately, roads and parcels should be created in CAD and then imported.
Let's compare two shapes as follows: Lot1 does not have the streetWidth attribute, and Lot2 has the streetWidth attribute.
We will extrude them and apply each selector. The code is as follows:
Lot -->
extrude(10)
color_comp
color_comp -->
comp(f) {
street.front : color("#ff0000") |
street.back : color("#00ff00") |
street.left : color("#0000ff") |
street.right : color("#ffff00") |
street.side : color("#00ffff") |
all : color("#cccccc")
}
The result is...
Both lots are colored, but the behavior differs. Lot1 does not have a streetWidth attribute. CityEngine treats its First Edge as street.front. Lot2 uses its assigned street attributes, so the result is correct.
Please remember: if the streetWidth attribute is missing, CityEngine treats the First Edge as street.front. Keep this in mind.
When drawing parcels in CAD, the starting point of a polygon may vary because road adjacency is not always considered during the drafting process.
If you import such data into CityEngine, you might find that unwanted faces are selected when choosing surfaces based on the road.
Therefore, when importing a large number of parcels, it is recommended to also import the road lines, select the parcels, perform 'Compute First/Street Edge', and then apply the selectors. In practice, skipping this step often leads to inconsistent facade selection, especially in large datasets. In practice, skipping this step often leads to inconsistent facade selection, especially in large datasets.
- Learn roof component selection in [037] How to Select Roof Edge Types Using Comp(e) Selectors in CityEngine
- Continue learning with [039] Procedural Modeling Practice in Esri CityEngine: Split, Comp, and Extrude
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.)