Select to view content in your preferred language

Getting started

1206
6
07-26-2013 08:45 AM
MattO_Keeffe1
Deactivated User
I've downloaded trial of City Engine and am keen to throw some test data into the software to see how it performs.

I have a shape file which contains polygons depicting the footprint of individual units in a block of apartments.  The attribution of the shape file is as follows:

UNITNUMBER (int)
FLOORLEVEL (int)
FLOORHEIGHT (int)
FORSALE (boolean)

The apartment block consists of three floors (FLOORLEVEL is either 0, 1 or 2) and the FLOORHEIGHT is always 10 (feet).  I'd like to colour the units red or green depending on whether the unit is for sale or not.

Can someone advise me how best to get started?

many thanks
0 Kudos
6 Replies
MattO_Keeffe1
Deactivated User
Figured out how to colour a unit based on a value in the shape file.  Can't figure out how to set it up so that the bottom of the top floor unit is 20ft from the ground.
0 Kudos
JoanneO_Brien
Deactivated User
Do you have the attributes for the parcels contained in the object attribute tables?
if so, first you need to link to the attribute, and then create a rule to extrude by the specific heights and floor numbers. Because you're data is in feet and CE calculates its values in metres you'll first have to convert the feet into metres before extrusion.

eg:
attr UNITNUMBER = 0 # these link to the attributes in your attribut table
attr FLOORLEVEL = 0
attr FLOORHEIGHT =0
const unitScale = 0.3048 # this is for the conversion from feet to metres

attr FloorHeight_metres = FLOORHEIGHT*unitScale



then you just need to continue writing the rules. If you want to use your FLOORLEVEL attribute I suggest you set up something like a conditional rule to tell it at each of the different heights extrude by the FLOORLEVEL*FloorHeight_metres and split by FloorHeight_metres into the seperate floors.

If you're confused about the coding you really should do all the tutorials first and check out some of the example codes where you get stuck.

hope that helps
0 Kudos
MattO_Keeffe1
Deactivated User
Thank you for the reply.

If my understanding of the split function is correct then that will seperate a single[/] polgyon into n floors depending on the variable that I declare.

In my dataset I've got three polygons placed on top of each other.  I need the ground/first floor (first polygon) to be 10ft high and for the floor to be fixed to the ground.  The second floor (second polygon which will have a copmpletely different set of attributes) needs to be 10ft high and for the base to be 10ft off the ground.  Third floor (third polygon - again, different attributes), base needs to be 20ft off the ground and 10ft high.

I'm not splitting a single polygon into three floors.  I can't see any reference in the examples or tutorials about how to achieve this, hence asking here.
0 Kudos
JoanneO_Brien
Deactivated User
That shouldn't be too hard. If you try something like a simple block form first, you can use the same rule for all three parcels just say:
attr UNITNUMBER = 0 # these link to the attributes in your attribut table
attr FLOORLEVEL = 0
attr FLOORHEIGHT =10
const unitScale = 0.3048 # this is for the conversion from feet to metres

attr FloorHeight_metres = FLOORHEIGHT*unitScale
Lot--> case FLOORLEVEL == 1 : A
  case  FLOORLEVEL == 2 : B
 case  FLOORLEVEL == 3 : C
 else: NIL

A--> extrude(FloorHeight_metres) ACont.
B--> extrude(FloorHeight_metres*FLOORLEVEL) split(y){FloorHeight_metres : NIL | ~1 : BCont.}
C-->  extrude(FloorHeight_metres*FLOORLEVEL) split(y){FloorHeight_metres*(FLOORLEVEL-1) : NIL | ~1 : BCont.}


That's just one potential way to do it, although there would be plenty of others. In this what you're doing is saying that for each parcel which has the attribute of a certain floor level you're extruding by that number of floorheights and then all the floorheights under the floor you're interested in are NIL (therefore nothing appears) and continue the code from there.

I haven't tested the code and you can play around for a better and more generic way depending on what you want but the principle is the same! Good luck 🙂
0 Kudos
MattO_Keeffe1
Deactivated User
That's really useful, thank you.

Any reason why I wouldn't be able to colour anything above the first floor?
0 Kudos
JoanneO_Brien
Deactivated User
Colourising each floor shouldn't be an issue. In the example I showed earlier, if you continued the code for each floor you should just need to apply the colour then, just make sure you take the full stop out so that it continues the code further eg:

ACont--> color("#FFFFFF")
BCont-->color("#FF0000") etc


hope it sorts itself out! 🙂
0 Kudos