Posts

Showing posts from July, 2026

[058-059] Applying Colors and Shape Attributes in CityEngine CGA

Image
Learn the color() and set() commands in Esri CityEngine to apply materials and control dynamic shape attributes programmatically. This comprehensive CGA scripting tutorial covers the dual approaches to rendering materials in Esri CityEngine. You will learn how to apply simple colors using hexadecimal values and RGB arrays, modify shape properties dynamically with the set() command, and implement the @Hidden annotation to keep programmatically overridden attributes from causing interface conflicts in the Inspector UI. So far, we have covered the most basic commands that define shape geometries: comp, split, extrude, and scope. Applying Colors in CityEngine CGA Starting today, we will look at commands for applying materials to shapes. First, we will examine the color command, which applies a simple color to a shape. Below is the reference for the color command. figure 1 : CGA color Command Reference ( https...

[056-057] Understanding alignScopeToGeometryBBox() in CityEngine CGA

Image
Learn how procedural scope re-alignment and external 3D model positioning work in CityEngine using alignScopeToGeometryBBox(). In this comprehensive guide, we dive deep into the mechanics of the alignScopeToGeometryBBox() command. Learn how it computes bounding boxes on specified projection planes using local geometry axes instead of world coordinates, and discover how to properly align imported external 3D models (OBJ) for flawless urban simulations. Part 1: Reorienting the Scope with Basic Geometry Today, we wrap up our multi-part series on scope alignment by focusing on the final and highly versatile command: alignScopeToGeometryBBox() . How alignScopeToGeometryBBox() Works At first glance, since this command automatically calculates and configures the scope as long as you specify a projection plane, it might seem like a simpler or more automated version of alignScopeToAxes() . However, the command actually follows t...

[055] Practice Scope Alignment in Esri CityEngine CGA with a Shape Prediction Exercise

Image
Understand scope alignment and coordinate system shifts in Esri CityEngine through a practical shape-prediction coding exercise. In this tutorial, we will take a deep dive into CityEngine's local coordinate systems and scope axes. By predicting the final 3D geometry from a sample CGA code and comparing it with the Model Hierarchy panel, you will learn how to accurately identify scope origins and coordinate orientations to prevent errors in procedural modeling. Practice Predicting Scope Alignment Results in CGA Shall we do a simple exercise? While inferring the code from the completed shape is a good method, predicting the completed shape by looking at the code is also an excellent exercise. Take a look at the code below and try to guess what the final shape will look like. alignScopeToGeometry_02.cga CGA Rules 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27...

[054] How to Use alignScopeToGeometry() in Esri CityEngine CGA

Image
Understand precise coordinate bounding box alignment using alignScopeToGeometry() in Esri CityEngine to snap scope planes to specific geometry faces and edges without manual calculation errors. Managing coordinate bounds (Scope) is critical for procedural 3D modeling in CityEngine. While basic component splits dynamically generate temporary local coordinate systems, manipulating complete 3D models as single entities requires explicit scope reorientation. This tutorial contrasts manual scope rotation via rotateScope() with precise automatic snapping using alignScopeToGeometry(), illustrating how to retrieve face and edge indices through the Inspector for flawless procedural splits. Why Scope Alignment Matters in CityEngine You might wonder, "If separating with comp(f) automatically creates a scope aligned to the face, why do I need to use other commands to set the scope?" That is correct. If you are worki...

[053] How to Use rotateScope() for Angled Splits in CityEngine CGA

Image
Rotate the procedural bounding box to control the angle of facade divisions. This tutorial explores how the coordinate system (scope) affects splitting operations in Esri CityEngine. By combining alignScopeToAxes and rotateScope, you will learn how to achieve complex diagonal divisions on 3D geometry and understand the relationship between world axes and local procedural space. Recommended Audience: Beginners in CGA coding and GIS professionals looking to master coordinate transformations for urban modeling. How Scope Direction Affects split() Operations As I mentioned previously, the reason for changing the scope is to perform operations like splitting, moving, and scaling in the desired direction. Today, we will use rotateScope() to rotate the scope and see how the results of split() change accordingly. @Group ( "Select_Axes" , 0) @Enum ( "world.xyz" , "x" , "y...

[052] How to Align Scope to Axes in Esri CityEngine

Image
Understand the alignScopeToAxes command to align Scope with world or object coordinates. In this lesson, we explore how the Scope—the invisible bounding box used in procedural modeling—aligns itself to different world and object axes. Understanding this alignment process is essential for accurate splitting, moving, and scaling operations in CityEngine CGA. In the last lesson, we examined how the scope surrounds a model based on a 2D plane. Today, we will look at how the scope is structured based on 3D volumes, starting with the alignScopeToAxes command. Understanding alignScopeToAxes Parameters The reference for alignScopeToAxes is as follows: figure 1 : https://doc.arcgis.com/en/cityengine/latest/cga/cga-align-scope-to-axes.htm At first, the official reference can feel a bit difficult to understand. Rather than worrying too much about the technical reference, you can think of it simply as follows: ...