Using FAR to generate building volumes

Discussion created by nicolaisteino2 on Nov 2, 2012
Latest reply on Oct 7, 2013 by lliskauskas-hnit-baltic-lt-esridist
I am interested in using the Floor Area Ratio (FAR) as a basis for generating building geometry. Say you have a 2.000 sqm lot with an allowed FAR of 0.75. I could then place a building with a total floor area of 1.500 sqm. Depending on the size of the footprint this would result in a given number of possible floors. For instance, a 300 sqm footprint would allow 5 floors.

In order to do so, I need to call the area of the lot (using the geometry.area function, I assume), as well as the are of the foot print. But I can't figure out how to get the areas of the lot and the footprint and then use it to calculate the possible number of floors for my extrude.

How do you do that?

I am new to CE (and to scripting altogether) but I kind of get the general works of it. I made a very crude script (see below) which hopefully gives and idea of where I want to go. It doesn't call the mentioned areas though, as I can't figure it out.




* File:    FAR_rule.cga
* Created: 30 Oct 2012 17:49:06 GMT
* Author:  nic

version "2012.1"

attr FAR = 1.5
attr SCALING = 0.5
attr floorHeight = 3
attr groundfloorSetback = 0.5
attr topfloorSetback = 2
attr facadeColor = listRandom("#FFDEAD;#F5DEB3;#DEB887;#D2B48C;#CD853F")

Lot --> color("#A9A9A9") Ground. s('SCALING,0,'SCALING) center(xz) Building
Building --> innerRect
extrude(floorHeight/SCALING/SCALING*FAR) Envelope
Envelope --> split(y){ ~floorHeight : Floor }*
Floor --> case (split.index == 0) :
       color("#808080") X
       case (split.index == :
       center(xz) Topfloor
       color(facadeColor) X

Topfloor --> comp(f) {side : TopFloorFacade | top : Roof }
   TopFloorFacade --> color("#87CEFA")
   Roof --> color(listRandom("#D3D3D3;#A9A9A9;#696969"))