Extrude elevation instead of height

12-15-2013 08:42 AM
New Contributor

I'm a new user of CityEngine, i'm a engineering student in topography (french).

I would like to know if it's possible to get the coordinates of a shape in order to use them in the python code ?

For example I have a shape at the elevation of 400 meters and I'd like to extrude it until 420 meters.

Something like this:

attr shapeType = ""
attr Altitude = 420

Height = Altitude - (?? get the shape elevation ??)

Lot -->
case shapeType == "LotInner" :
else :
  extrude(world.y, Height) comp(f) { side : Wall | top : Roof }

Thanks for your answers.
Tags (2)
0 Kudos
4 Replies
New Contributor II
Hi there,

are you looking to extrude the building to it's actual height? (e.g are you trying to make an accurate representation of a real life building?)

also is the 400m altitude an attribute of the underlying terrain?
0 Kudos
New Contributor
Thanks for your answer,

I have a Raster DTM at around 400 m.
I have aligned shapes to terrain.
So my shapes have all a different altitude. Around 400 meters.
Yes i'm trying to make an accurate representation of real buildings, wich I know their top altitude.

I would like to extrude buildings at 420 m for example. Ok I can extrude 20 m.
But how to use the altitude ? How can I get the altitude of the shape ?

Then I could have:

attr Altitude = 420 m

Height = Altitude - ShapeAltitude

extrude(world.y, Height) ...
0 Kudos
New Contributor II
I am not aware of any way that you can determine the altitude from the DTM in order to use it within a rule file (although someone may be able to tell you differently??)

Obviously in your case this would be useful as it would allow you to create a rule whereby building height= TopofShapeAltitude-DTMaltitude.

Instead, perhaps you could look at using arcMap for example in order to create an attribute for your building lots?
eg. If you had DTM and DSM you could work out building height by DSM-DTM.

That way you could extrude to your building height attribute without having to worry about any calculations within CityEngine?
0 Kudos
Frequent Contributor
hi Jamie,

Please watch this:


Terrains automatically set up some mapping code in the Terrain Layer attributes that lets you sample the elevation value.

Hope this helps !

0 Kudos