Select to view content in your preferred language

Getting shape height using floors numbers

2850
4
07-26-2016 01:46 PM
Joao_PedroMarques
Occasional Contributor

Hi everyone. I'm new to CityEngine and i'm totally in the dark with a question.

The question is:

How to i extrude my building shape files, when i only have number of floors for each building in the database? Is it possible to generate the building, knowing from the start that the average floor is 3meters height?

What would be the rule for this example?

Thank you.

Tags (2)
0 Kudos
4 Replies
DevinLavigne
Frequent Contributor

This is pretty simple. This is from the help file:

To use these attributes with the CGA grammar you need to declare CGA attributes with matching names. A simple CGA rule file could look like this:

attr height = 10  Lot --> extrude(height)

After assigning this rule file to the shapes, the CGA attribute height appears in the CGA Attribute Mapping tab of the Inspector. Note that the Source field is set to Object, which denotes that the CGA attribute height is controlled by the object attribute of the lot.

So in your case this is all you would need to do

attr Your_Shapefile_Field_Name_For_Floors = 10  #value can be anything as it will map to the data
attr avgFloorHeight  = 3 #setting this as an attribute will give you the ability to change in each building if necessary

@StartRule
Lot --> extrude(Your_Shapefile_Field_Name_For_Floors * avgFloorHeight) #again you could hardcode "3" here
Joao_PedroMarques
Occasional Contributor

Wow, thanks for the fast replay.

Well it worked like a charm, fantastic just fantastic.

I definitly need to read again and again the help file. Is it possible to get the help file in a .pdf format?

Thank you once again, Devin.

0 Kudos
LR
by
Frequent Contributor
Joao_PedroMarques
Occasional Contributor

Nice tip!

Thanks, JR