Select to view content in your preferred language

Report -> Object Attribute

09-04-2013 04:20 AM
New Contributor III
I'm making some calculations in cityengine and i'm facing a problem at this moment.
I can have the reports os this calculation but i need to transform it in a object attribut in the layer Lots that is already in the cityengine. I need this because i should make some other calculations with the result of this report.
I'm trying to calculate the volume of the real city and the legally city. I need to subtract the volumes results to have a constructive stock. My first problem is how to calculate volume and that how can i put this report in the attributes of an object.
Here is the code:

attr Frontal = 6

attr Lateral = 3
attr TO = 0.4
attr CA = 3
attr GFHeight = 3
attr UFHeight = 3

myFunction = 0.0

attr parcelArea = 0

Lot --> Area(geometry.area)

Area(area) --> set (parcelArea, geometry.area) report ("Area do Lote PD", parcelArea) Afast_F(area)

Afast_F(area) -->  setback(Frontal) { streetSide : NIL  | remainder : Afast_L(area) }

Afast_L(area) --> setback(Lateral) { noStreetSide : NIL  | remainder : projecao(area) }

projecao(area) --> case geometry.area > area * TO :  Redimensiona(area, geometry.area)
else : Sobe(area, geometry.area)
Redimensiona(area, areaP) -->   s('area*TO/areaP, 'area*TO/areaP, '1) center (xz)  Sobe (area, geometry.area)

Sobe (area, areaSC ) --> 
split (y) {GFHeight : Volume("GF") | ~1 : UpperFloor }

UpperFloor -->
split (y) { ~ UFHeight : Volume("UF") } *

Volume (volumeType) -->
case volumeType == "GF":
  color ("#990000")
  set (material.opacity, 0.5)
else :
  color ("#990000")
  set (material.opacity, 0.5)
Reporting -->
report("Primeiro Andar PD", geometry.area(bottom))
report("Demais Andares PD", geometry.area(bottom) / parcelArea )

Tags (2)
0 Kudos
2 Replies
Frequent Contributor II

You'll need to create a Python script for this. This cannot be done automatically in the GUI.

If you go through tutorial 12 very carefully (, you'll find a way to access reported values. Make sure you download the tutorial files, this is not covered in the video version.

Once you have the values, you can create an object attr with this.

Try diving into this. I can help you later on if questions remain.

0 Kudos
New Contributor III
Thanks, Matt!
I'll try to do it!
0 Kudos