# How can I display different densities in three levels with different colors?

344
2
12-17-2017 12:28 AM
New Contributor II

hello dear friends

• I wrote the rules for calculation the density

/**
* File: FAR.cga
* Created: 3 Dec 2017 17:57:03 GMT
* Author: mazyar
*/

version "2017.1"

@Group("Floor Num & Height",0) @order(0)
@Range(1,15)
attr FloorNum =rint(Height/3)

attr FloorHeight =3

attr Height =0

#####################################################
@Range(0,1)
attr Transparent =1

#####################################################

@Group("Building_Setback",3) @order(0)

@Range(0,10)
attr Front =5

@Range(0,10)
attr Back =3

@Range(0,10)
attr Side =2

@Hidden
attr ParcelArea =0

###################################################

@Group("FRA Reporting",3) @order(0)
@color
attr Low_FAR_Color ="#FF00FF"

@Group("FRA Reporting",3) @order(1)

@color
attr Medain_FAR_Color ="#00FF00"

@Group("FRA Reporting",3) @order(2)

@color
attr High_FAR_Color ="#0000FF"

##############################################

Lot -->
set(ParcelArea ,geometry.area())
report("LotArea" ,geometry.area())
setback(Front) { street.front : NIL | remainder :
setback(Back) { street.back : NIL | remainder :
setback(Side) { street.side : NIL | remainder :
Building
}
}
}

Building -->
extrude(FloorNum *FloorHeight)
split(y) { ~FloorHeight : Floors }*

Floors -->
case FAR > 0 && FAR <= 30 :color(Low_FAR_Color)set(material.opacity,0.4)
FARReporting
case FAR > 30 && FAR <= 60 :color(Medain_FAR_Color) set(material.opacity,0.4)
FARReporting
case FAR > 60 && FAR <= 100 :color( High_FAR_Color) set(material.opacity,0.4)
FARReporting
else :color(1,1,1)

FARReporting -->
report("FARBuilding" ,geometry.area(bottom)*FloorNum/ParcelArea)

FAR =geometry.area(bottom)*FloorNum/ParcelArea

/*ReportingBuilding -->
case FAR <= 0.30 :color(Low_FAR_Color)
set(material.specular.r,1)
set(material.specular.g,1)
set(material.specular.b,1)
set(material.opacity,Transparent)
set(material.reflectivity,0.5)
set(material.shininess,50)
case FAR > 0.30 && FAR <= 0.60 :color(Medain_FAR_Color)
set(material.specular.r,1)
set(material.specular.g,1)
set(material.specular.b,1)
set(material.opacity,Transparent)
set(material.reflectivity,0.5)
set(material.shininess,50)
case FAR > 0.6 && FAR <= 1 :color( High_FAR_Color)
set(material.specular.r,1)
set(material.specular.g,1)
set(material.specular.b,1)
set(material.opacity,Transparent)
set(material.reflectivity,0.5)
set(material.shininess,50)
else :color(1,1,1)

*/

• these are my rules for calculation the density

• now i want to classify densities in three modes of low density , moderate density (average) and high density

• so i can each floor is shown in a different color

• how do i do it?

• considering that the densities are in percent

• but in the conditional function i e case & else , the number can not be written as percent

• Floors -->
case FAR > 0 && FAR <= 30 :color(Low_FAR_Color)set(material.opacity,0.4)
FARReporting
case FAR > 30 && FAR <= 60 :color(Medain_FAR_Color) set(material.opacity,0.4)
FARReporting
case FAR > 60 && FAR <= 100 :color( High_FAR_Color) set(material.opacity,0.4)
FARReporting
else :color(1,1,1)

• I mean this part

2 Replies
Esri Regular Contributor

I'm not sure I understand what you want to do.  If FAR is calculated for the building as the total floor area divided by the lot area, then there is one value for FAR for the whole building.  How do you want to calculate FAR per floor?  Do you want to consider only the floors up until that floor, meaning that the floors above that floor do not count?  For example, if the building has 5 floors total, would the FAR value for the second floor only consider the areas of the first and second floors, disregarding the third, fourth, and fifth floors?  In that case, you can change your calculation of FAR to use split.index.

``FAR = geometry.area(bottom)*(split.index+1)/ParcelArea‍``

This gives you the floor area of one floor multiplied by the floor number all divided by the parcel area.  Note that split.index starts at 0 for the ground floor, so add one to get the floor number.

New Contributor II

very thanks Cheryl Lau