Posts

Showing posts from June, 2026

[042] Understanding case...else Conditional Rules in CityEngine CGA

Image
Implement conditional decision-making in your procedural models using case...else statements and verify results with the color command. This tutorial explains the unique syntax requirements of conditional logic in CityEngine's CGA language. We discuss how to properly structure branching rules to avoid syntax errors, the necessity of the NIL command, and why placement within a rule matters. Additionally, we touch upon using the color command as a powerful tool for geometry selection verification. First, let's talk about `case...else`... As I mentioned in the earlier lectures, there are certain CGA commands that frequently travel together. Among them, one of the most common combinations is `index` used together with `case...else` statement. How case...else Differs from Traditional Programming Logic `case...else` acts like a signpost at a fork in the road when a condition is given for a variable or constant, classifying va...

[041] How to Precisely Target Faces Using comp.index in CityEngine CGA

Image
Learn how to find and use the comp.index value via the Inspector panel to precisely target and apply rules to individual faces. In procedural modeling, selecting a specific face among hundreds can be challenging with general orientation-based selectors. This tutorial demonstrates how to identify the unique index of a component and utilize it within conditional CGA rules for absolute precision in your 3D urban designs. I previously covered split.index, but as I began creating more complex forms, I realized that comp.index deserved its own explanation, so I’ll briefly cover it here. Why Traditional Selectors Are Sometimes Not Enough As you proceed with rules, the number of faces increases. To pinpoint and select a specific face, you need to use a combination of various selectors. However, selectors such as front selectors, object coordinate selectors, and world coordinate selectors operate within specific spatial conditions ...

[040] Understanding Object Coordinate Selectors in CityEngine

Image
Learn the fundamental differences between local and object coordinate systems to achieve consistent procedural results. This tutorial explains how to differentiate between local selectors and object-based selectors in CityEngine CGA. By understanding the hierarchy of coordinate systems—World, Object, and Local—you will be able to reliably target specific building facades regardless of how complex your procedural rule tree becomes. I was planning to move on to creating forms using indices, but then I remembered that I skipped an explanation of object.front, object.right, object.left, object.back, and similar selectors when I previously covered comp(). img 1 : ESRI CityEngine CGA comp() Reference If you look at the reference above, front and back belong to the "local coordinate system," while selectors starting with object. belong to the "object coordinate system." So what exactly is the di...

[039] Procedural Modeling Practice in Esri CityEngine: Split, Comp, and Extrude

Image
Combine split, comp, and extrude commands to reinforce core CGA concepts through a practical exercise. This tutorial provides a hands-on exercise to practice the core procedural modeling commands in Esri CityEngine. By constructing a specific architectural form step-by-step, you will learn how local coordinate systems shift during extrusion and how to use the Model Hierarchy to track your progress accurately. We have concluded our basic lessons on the split command in the previous sessions. The initial shape for this exercise is a rectangle 30m wide and 10m deep. The bottom edge is designated as the first edge. img 1 : Initial 30m x 10m rectangle We will now tackle the challenge of creating the shape shown below using CGA code. Since we haven't covered scale, translations, or coloring yet, we will focus purely on completing the form. img 2 : CityEngine comp and split practice form Tar...

[038] How to Select Street-Facing Faces with Comp() in CityEngine

Image
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. img 1 : Visualization of street selectors. Source: Esri CGA Documentation img 2 : Definitions of front, back, left, and right relative to the street. 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 ri...

[037] How to Select Roof Edge Types Using Comp(e) Selectors in CityEngine

Image
Classify and isolate specific roof components like eaves, ridges, and valleys to apply detailed architectural textures and geometries. This tutorial explores the specialized edge selectors in CityEngine's comp(e) command. By understanding how the software defines the topography of a roof—similar to mountain ridges and valleys—you can precisely target edges for gutters, ridge tiles, and structural details. Do you like hiking? In Korea, mountains are one of the most common sights. When we describe the topography of a mountain, we use terms like "ridge" for elevated paths, "valley" for recessed terrain, "ridges" for elevated paths and "valleys" for recessed terrain. In CityEngine, you can select specific edges by providing conditions similar to these topographical features. Core Technical Definitions of Roof Edge Selectors CityEngine provides several edge selectors specificall...

[036] CityEngine comp(): Selecting Sloped Faces with Horizontal, Vertical, Aslant, and Nutant

Image
Learn to target specific building surfaces based on their angle and orientation using sloped-based comp selectors. This tutorial explains how to use the horizontal, aslant, vertical, and nutant selectors in the comp() command. It provides a deep dive into how CityEngine classifies faces based on their normal angles relative to the local coordinate system and explains selector precedence when multiple selectors coexist within a single comp() rule. First, take a look at the example below. img 1 : Sphere model used for selector testing The following code demonstrates how to apply these selectors to the sphere shown above. CGA Code Example and Visual Results Lot1 --> primitiveSphere(10, 10, 10) Horizontal Lot2 --> primitiveSphere(10, 10, 10) Aslant Lot3 --> primitiveSphere(10, 10, 10) Vertical Lot4 --> primitiveSphere(10, 10, 10) Nutant Horizontal --> comp(f){horizontal : color(1,0,0) X.} Aslant --> comp...