Can CityEngine use feet or does all attribute data need to be converted to metric sys

4336
7
07-02-2013 07:20 AM
TroyEvangelho
New Contributor
Can CityEngine accurately extrude and report data in feet or only meters? So far the only success I've had extruding my shapefile attribute data, has been to convert the units to meters before importing into CityEngine.

Since I am a planner in the United States, all of data I work with and reports I wish to produce are in feet, not the metric system. All of the shapefile attribute data I use are in feet. For example, building height, perimeter, area, etc. Also, all of reporting I want to do would be in feet. For example, determining the square feet of a proposed development.

Thanks for the help.
Tags (2)
0 Kudos
7 Replies
nicholascarrington
New Contributor
When using CGA scripting the units are in meters.
I too ran into this a while back. it would be nice if this can be tweaked in the grammar core.
0 Kudos
TroyEvangelho
New Contributor
Thanks Nicholas,

Were you able to use your original data and code around it, or do you have to convert all your attributes to the metric system before importing into CityEngine?
0 Kudos
nicholascarrington
New Contributor
Yeah so the  data has to stay original.
I must have did the math and figured it out in the CGA scripting.
0 Kudos
JoanneO_Brien
Occasional Contributor
you could add a constant into your cga code that automatically calculates the meters for you eg:

const unitScale = 0.3048 


Then you just times the attribute by the unitScale

eg
s(0,20*unitScale,0)
0 Kudos
TroyEvangelho
New Contributor
Thanks for the tip. I'm new to CGA codeing, I tried implementing your suggestions, however I think I've coded it wrong. See my attempt below, let me know if you know how to fix it.

/**
* File:    3d_extrude_feet.cga
* Created: July 3, 2013
* Author:  tevangelho
*/

version "2012"

const unitScale = 0.3048

# inizialize attrs
attr HEIGHT = 0*unitScale


@StartRule
Lot -->
extrude(HEIGHT)
0 Kudos
JoanneO_Brien
Occasional Contributor
Hi
The issue will be in your attribute calling.
First you'll need to call the attribute, so that it reads the height value in your attribute table, and then multiply eg:
const unitScale = 0.3048

# inizialize attrs
attr HEIGHT = 0 #This calls the height attribute
attr MeterHeight = HEIGHT*unitScale #This converts the feet into meters


@StartRule
Lot -->
extrude(MeterHeight) 


Hope that helps 🙂
0 Kudos
TroyEvangelho
New Contributor
That works like a charm. Thank you so much Joanne, you made my day.
0 Kudos