Frequently asked question

How do I place street furniture like lamp poles or trees?

Last Published: April 25, 2020

Answer

Elements can be placed on streets or sidewalks by using CGA code.

Note:
CGA stands for Computer Generated Architecture, a scripting language specific to Esri CityEngine and used to generate 3D content. See the link to the 'Basics of Rule-based Modeling' in the Related Information section below.

The best strategy is to duplicate the start shape (street or sidewalk) for each type of object that is to be placed.

Example code:

Code:
Sidewalk -->
SidewalkShape. # Original shape
PutTrees # Duplicate of the shape for placing trees

The actual placement is then done in a new rule by splitting the shapes using the split(u or v) directions. The precise placement is usually done by first splitting strips of the shape (in the short dimension), then splitting those strips into small repetitive parts (in the long dimension), and finally replacing each of the resulting shapes with the actual assets, for example, trees.

The following code example shows how to place vertical poles along a sidewalk:

Code:
Sidewalk -->
SidewalkGeometry.
SidewalkObjects # shape duplicated!

# idea : we cut off small strips of the original shape sideways and along the length of the sidewalk.
# on the remaining shape 'dots' (small rectangular shapes), we insert a post.

attr placementWidth = 0.05

attr streetDist = 0.2
attr objectDist = 5

attr objectSize = 0.1
attr objectHeigt = 2

SidewalkObjects -->
# split sideways the sidewalk shape
split(v,unitSpace,0) { streetDist : NIL | placementWidth : PlacementStrip | ~1 : NIL }


PlacementStrip -->
# split along the sidewalk shape
split(u,unitSpace,0) {objectDist: NIL | placementWidth : PlacementPoint }*

PlacementPoint -->
alignScopeToGeometry(yUp, 0) # align the shape to the current point shape, thus the street direction!
#r(0,90,0) # toggle 90 degree rotation, e.g. for lamp poles
s(objectSize*2, objectHeigt, objectSize)
i("builtin:cube")
center(xz)


Article ID:000011366

Software:
  • ArcGIS CityEngine Prev

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options