Report doesn't appear to report all floors

831
10
Jump to solution
04-15-2013 09:21 AM
LoringTupper
New Contributor
I have a CGA rule that extrudes the building and then splits it into the ground floor that has a height of 5M and the remainder are upper flooors that have a height of 4M. The rule then goes on to report the GFA and FAR but in both of those the number of floors appears to be 1 less than the total, I believe it is because the last split was for the upper floors and the ground floor is being ignored. How do I get the report to include all of the floors?

The CGA code is below:

attr FSetback = 1.5
attr BSetback = 5
attr LSetback = 5
attr RSetback = 5
attr height = 46
attr LUColor = "#ff6464"
attr GroundFloorHeight = 5
attr UpperFloorHeight = 4

@Hidden
attr plotArea = 0 # used to calc FAR

@StartRule
Lot --> setback(FSetback) { street.front : Concrete | remainder : Sub1 }
    
Concrete --> color("#CCCCCC")   #Grey

Sub1 --> setback(BSetback) { street.back : Concrete1 | remainder : Sub2 }

Concrete1 --> color("#CCCCCC")  #Grey

Sub2 --> setback(LSetback) { street.left : Concrete2 | remainder : Sub3 }

Concrete2 --> color("#CCCCCC")  #Grey

Sub3 --> setback(RSetback) { street.right : Concrete3 | remainder : Building }

Concrete3 --> color("#CCCCCC")  #Grey

Building --> extrude(world.y,height)
color(LUColor)
set(plotArea, geometry.area)
BuildingVolume3D

BuildingVolume3D -->
# the 3d volume will not be split into smaller 3d volumes ! 1 ground floor volume will be created.
split(y) {GroundFloorHeight : Volume("GF") | ~1 : AllUpperFloors}

AllUpperFloors -->
# the rest of the volume is not split into upper floor volumes, as many times as possible ('*' sign)
split(y) {~UpperFloorHeight : Volume("UF")}*

Volume(volumeType) -->
case volumeType == "GF" :
  color ("#646464")
else :
   color (LUColor)

set(material.opacity,0.6) FloorCalc

FloorCalc -->
report("GFA",geometry.area)
report("FAR",geometry.area/plotArea)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor
0 Kudos
10 Replies
LoringTupper
New Contributor
I should add that the building is not presented graphically the way I expected and the way that it was prior to adding the section for the report:

[ATTACH=CONFIG]23521[/ATTACH]
0 Kudos
LoringTupper
New Contributor
One more thing, the numbers in the report for the FAR don't make a lot of sense. Under the "N" is the number 10, which seems to reflect the number of floors. This would be correct if the area of the parcel and the area of the base of the building were the same, and that may be my problem. I'm using various sample "report" CGA files to get an idea of how to do the report I need and in tose CGAs there was a variable called "PlotArea". Is this a special term for CGA? Shoudl I be using it or should I be using the Object attribute SHAPE_Area from my GDB layer? I've tried both and it didn't seem to make any difference.

to get the FAR I think that the "geometry.area/PlotArea" calcualtion is dividing the total floor area of the building not by the area of the parcel but by the area of the base of the building, but I can't see how to change that if it is.
0 Kudos
MatthiasBuehler1
Frequent Contributor
Building -->
    extrude(world.y,height)
    color(LUColor)
    set(plotArea, geometry.area)


This is wrong, because when you call geometry.area, it's calculated based on the current shape. You have already extruded the shape, thus you're calculating the surface of the extruded shape, not the building footprint.
Also, the footprint would be wrong of course, you need to have the parcel area.

Read on here :
http://forums.arcgis.com/threads/82190-CGA-FAR-calculations


Volume(volumeType) -->
    case volumeType == "GF" :
        color ("#646464")
        FloorCalc
    else :
        color (LUColor)
        set(material.opacity,0.6)
        FloorCalc


You did not call FloorCalc in the case statement for 'GF'.

Ok ?
0 Kudos
LoringTupper
New Contributor
Thanks for the quick reply. I did look at that thread you mentioned earlier and because the CGA code is not really documented, i.e. there's no comments on the code, it wasn't any more helpful than the CGA from the tutorials which is what I had used for reference.

I made the change that you recomended and the FAR and floor area calculations are now correct. That said, I'm still confused with the plotArea attribute, where does that come from, is it supposed to be an attribute on the shape or is it something that is built into CGA/CityEngine, a reserved attribute of some type?

I'm also confused over why the building envelope keeps disappearing when I run his rule and only the "floors" are displayed. I see nothing in the code that says turn off the building and just show the floors, to be honest I woudn't have a clue how to do such a thing.

my code now looks like the following:

attr FSetback = 1.5
attr BSetback = 5
attr LSetback = 5
attr RSetback = 5
attr height = 46
attr LUColor = "#ff6464"
attr GroundFloorHeight = 5
attr UpperFloorHeight = 4
attr SHAPE_Area = 0 #parcel polygon area from GDB

#@Hidden
attr plotArea = 0 # used to calc FAR

@StartRule
Lot -->
setback(FSetback) { street.front : Concrete | remainder : Sub1 }
    
Concrete --> color("#CCCCCC")   #Grey

Sub1 --> setback(BSetback) { street.back : Concrete1 | remainder : Sub2 }

Concrete1 --> color("#CCCCCC")  #Grey

Sub2 --> setback(LSetback) { street.left : Concrete2 | remainder : Sub3 }

Concrete2 --> color("#CCCCCC")  #Grey

Sub3 --> setback(RSetback) { street.right : Concrete3 | remainder : Building }

Concrete3 --> color("#CCCCCC")  #Grey

Building --> extrude(world.y,height)
color(LUColor)

BuildingVolume3D

BuildingVolume3D -->
set(plotArea, geometry.area) # the 3d volume will not be split into smaller 3d volumes ! 1 ground floor volume will be created.
split(y) {GroundFloorHeight : Volume("GF") | ~1 : AllUpperFloors}

AllUpperFloors -->
# the rest of the volume is not split into upper floor volumes, as many times as possible ('*' sign)
split(y) {~UpperFloorHeight : Volume("UF")}*

Volume(volumeType) -->
case volumeType == "GF" :
  color ("#646464")
  Floor
else :
   color (LUColor)
  
#set(plotArea, geometry.area)
set(material.opacity,0.6) Floor


Floor --> comp(f){ bottom: reverseNormals FloorBottom }

FloorBottom -->
report("GFA",geometry.area)
report("FAR",geometry.area/SHAPE_Area)
0 Kudos
MatthiasBuehler1
Frequent Contributor
hi !

the set () is still on the wrong spot, there, it makes no real sense since you're setting the area AFTER an extrude. setting the parcelArea must be the very first thing either directly at the start of a Lot ( = parcel Shape ) or if you have a footprint right at the start of the rule. In the latter case ( on a footprint shape ), it makes of course no sense to use geometry.area, because you NEED to set the parcel's area. Means if you have only a footprint shape, you need to 'inform' this shape how big the parcel area actually is. This can be done via an attribute or via sampling, as described in the other thread I mentioned.

In the case where you only have a footprint, make an attribute, e.g. with the basic initial value of 0, then set the value in the Inspector

attr 'parcelArea = 0'


If you have a parcel Shape :

Parcel -->
    set(parcelArea, geometry.area) # override the value with the actual geometry value


Hope this helps further ..
I know getting into CGA may be a bit tricky.
If I find time I'll try to record a video which explains those steps better, ok ?

Note :
For CGA, please use the 'code tag' ( the # button ), it's a bit better readable.
Also, just as a tip, try to layout the code properly, using tabs to indent case blocks and other stuff.. ok ? 🙂
0 Kudos
LoringTupper
New Contributor
That was quick, thanks so much for getting back to me.
I think I screwed up the cut and paste, the code I included in the last note was actually the code before the change. I do have the "set()" line before the extrude and the numbers in the report for the floor area and FAR are now being calcualted correctly. My only problem now is that when I apply the CGA code to a parcel the building doesn't look the way I want it to. The only thing visible is the floor plates, the building outline is missing. If I remove the line that contains the "comp(f)" the building is back to the way it should appear but the numbers on the report are no longer valid. The actual latest code is as follows:

attr FSetback = 1.5
attr BSetback = 5
attr LSetback = 5
attr RSetback = 5
attr height = 46
attr LUColor = "#ff6464"
attr GroundFloorHeight = 5
attr UpperFloorHeight = 4
attr SHAPE_Area = 0 #parcel polygon area from GDB

#@Hidden
attr plotArea = 0 # used to calc FAR

@StartRule
Lot --> 
 setback(FSetback) { street.front : Concrete | remainder : Sub1 }
     
Concrete --> color("#CCCCCC")   #Grey

Sub1 --> setback(BSetback) { street.back : Concrete1 | remainder : Sub2 }

Concrete1 --> color("#CCCCCC")  #Grey

Sub2 --> setback(LSetback) { street.left : Concrete2 | remainder : Sub3 }

Concrete2 --> color("#CCCCCC")  #Grey

Sub3 --> setback(RSetback) { street.right : Concrete3 | remainder : Building }

Concrete3 --> color("#CCCCCC")  #Grey

Building -->
 set(plotArea, geometry.area)
 extrude(world.y,height)
 color(LUColor)
 BuildingVolume3D

BuildingVolume3D -->
 
 # the 3d volume will not be split into smaller 3d volumes ! 1 ground floor volume will be created.
 split(y) {GroundFloorHeight : Volume("GF") | ~1 : AllUpperFloors}

AllUpperFloors -->
 # the rest of the volume is not split into upper floor volumes, as many times as possible ('*' sign)
 split(y) {~UpperFloorHeight : Volume("UF")}*

Volume(volumeType) -->
 case volumeType == "GF" :
  color ("#646464")
  Floor
 else :
  color (LUColor)
  Floor


Floor --> comp(f){ bottom: reverseNormals FloorBottom }
 
FloorBottom -->
 report("GFA",geometry.area) 
 report("FAR",geometry.area/SHAPE_Area)
 
set(material.opacity,0.6)


Do you see a reason why the building outline doesn't appear and I see only te floor plates?
0 Kudos
LoringTupper
New Contributor
So I managed to get the buildings back the way I wanted them and I started to do some further testing.

The way I have the CGA rules set up is there is a central CGA rule that looks at the land use attribute value on the parcel polygon and then calls up the rule for that land use. I've modified all of my land use rules to include the report mechanism and they all work when I select 1 or more parcels add apply the rule directly. If I use the central rule that calls the land use rule based on the value of the land use attribute on the parcel the report appears to have the right floor area but the FAR values are all set to 0, even the number of floors. This happens whether I select 1 parcel or a number of parcels, the FAR is always 0.

The code for the central CGA rule that calls up the appropriate land use CGA rule based on the object attribute value for the land use is as follows:

// land use types from the parcel object attribute.
attr PROPERTY_USE = " "

## importing.cga
import ruleC2: "Report_C-2.cga" 
import ruleC3: "Report_C-3.cga" 
import ruleC3_23: "Report_C-3_23.cga" 
import ruleCCCOR: "Report_CC-COR.cga" 
import ruleCCMH: "Report_CC-MH.cga" 
import ruleCCMHX: "Report_CC-MHX.cga" 
import ruleCCOR1: "Report_C-COR1.cga" 
import ruleCCX: "Report_CC-X.cga" 
import ruleCM1: "Report_CM-1.cga" 
import ruleCM2: "Report_CM-2.cga" 
import ruleI2: "Report_I-2.cga" 
import ruleRM7: "Report_RM-7.cga" 
import ruleSCS: "Report_S-CS.cga" 
import ruleOther: "Report_Other.cga" 



@StartRule
Lot-->
case geometry.area > 200:
     case PROPERTY_USE == "C-2" : ruleC2.Lot
     case PROPERTY_USE == "C-3" : ruleC3.Lot
     case PROPERTY_USE == "C-3(23)" : ruleC3_23.Lot
     case PROPERTY_USE == "CC-COR" : ruleCCCOR.Lot
     case PROPERTY_USE == "CC-MH" : ruleCCMH.Lot
     case PROPERTY_USE == "CC-MHX" : ruleCCMHX.Lot
     case PROPERTY_USE == "C-COR1" : ruleCCOR1.Lot
     case PROPERTY_USE == "CC-X" : ruleCCX.Lot
     case PROPERTY_USE == "CM-1" : ruleCM1.Lot
     case PROPERTY_USE == "CM-2" : ruleCM2.Lot
     case PROPERTY_USE == "I-2" : ruleI2.Lot
     case PROPERTY_USE == "RM-7" : ruleRM7.Lot
     case PROPERTY_USE == "S-CS" : ruleSCS.Lot
     case PROPERTY_USE == "Other" : ruleOther.Lot
     else: ruleOther.Lot
else: NIL


The rules that are called up are all similar to the below, only the attribute settings are different:

attr FSetback = 1.5
attr BSetback = 5
attr LSetback = 5
attr RSetback = 5
attr height = 46
attr LUColor = "#ff6464"
attr GroundFloorHeight = 5
attr UpperFloorHeight = 4
attr SHAPE_Area = 0 #parcel polygon area from GDB

@Group("Viz",4)
@Range("massOnly", "floors", "massAndFloors")
attr vizMode = "massAndFloors"

attr plotArea = 0 # used to calc FAR

@StartRule
Lot --> 
 setback(FSetback) { street.front : Concrete | remainder : Sub1 }
     
Concrete --> color("#CCCCCC")   #Grey

Sub1 --> setback(BSetback) { street.back : Concrete1 | remainder : Sub2 }

Concrete1 --> color("#CCCCCC")  #Grey

Sub2 --> setback(LSetback) { street.left : Concrete2 | remainder : Sub3 }

Concrete2 --> color("#CCCCCC")  #Grey

Sub3 --> setback(RSetback) { street.right : Concrete3 | remainder : Building }

Concrete3 --> color("#CCCCCC")  #Grey

Building -->
 set(plotArea, geometry.area)
 extrude(world.y,height)
 color(LUColor)
 BuildingVolume3D

BuildingVolume3D -->
 MassViz
 # the 3d volume will not be split into smaller 3d volumes ! 1 ground floor volume will be created.
 split(y) {GroundFloorHeight : Volume("GF") | ~1 : AllUpperFloors}

AllUpperFloors -->
 # the rest of the volume is not split into upper floor volumes, as many times as possible ('*' sign)
 split(y) {~UpperFloorHeight : Volume("UF")}*

Volume(volumeType) -->
 case volumeType == "GF" :
  color ("#646464")
  Floor
 else :
  color (LUColor)
  Floor


Floor --> comp(f){ bottom: reverseNormals FloorBottom }
 
FloorBottom -->
 report("GFA",geometry.area) 
 report("FAR",geometry.area/SHAPE_Area)
 MassViz
 
MassViz -->
 case vizMode == "massOnly" :
  Mass.
 case vizMode == "massAndFloors" :
  set(material.opacity,0.8) BuildingVolume3D.
 else:
  NIL


I'm not sure why the FAR is being wrongfully calculated or reported when I use the central CGA rule. The only thing I can think of is that some varialbe needs to be reset between each call, but if that is the case I don't know what that would be. Do you see anything in the code that would cause this problem?
0 Kudos
MatthiasBuehler1
Frequent Contributor
have a look here :

###############################################################################################################
# attributes
###############################################################################################################


@Group("SETBACKS",0) 
attr FSetback = 1.5
@Group("SETBACKS")
attr BSetback = 5
@Group("SETBACKS")
attr LSetback = 5
@Group("SETBACKS")
attr RSetback = 5

@Group("HEIGHTS",1)
attr height = 46
@Group("HEIGHTS")
attr GroundFloorHeight = 5
@Group("HEIGHTS")
attr UpperFloorHeight = 4

@Group("COLORS",2)
attr LUColor = "#ff6464"

@Group("VIZ",3)      @Range("massOnly", "floors", "massAndFloors")
attr vizMode = "massAndFloors"


###############################################################################################################
# generic, hidden attributes
###############################################################################################################

@Hidden
attr plotArea = 0


###############################################################################################################
# functions
###############################################################################################################

colorFunction ( volumeType ) =
 case volumeType == "GF" :
  "#646464"
 else :
  LUColor


###############################################################################################################
# parcelling
###############################################################################################################

@StartRule
Lot -->
 set (plotArea, geometry.area)
 setback(FSetback) { street.front : Concrete | remainder : Sub1 }
     
Concrete --> color("#CCCCCC")   #Grey

Sub1 --> setback(BSetback) { street.back : Concrete1 | remainder : Sub2 }

Concrete1 --> color("#CCCCCC")  #Grey

Sub2 --> setback(LSetback) { street.left : Concrete2 | remainder : Sub3 }

Concrete2 --> color("#CCCCCC")  #Grey

Sub3 --> setback(RSetback) { street.right : Concrete3 | remainder : Building }

Concrete3 --> color("#CCCCCC")  #Grey


###############################################################################################################
# building
###############################################################################################################


Building -->
 extrude(world.y,height)
 color(LUColor)
 BuildingVolume3D

BuildingVolume3D -->
 # the 3d volume will not be split into smaller 3d volumes ! 1 ground floor volume will be created.
 split(y) {GroundFloorHeight : Volume("GF") | ~1 : AllUpperFloors}

AllUpperFloors -->
 # the rest of the volume is not split into upper floor volumes, as many times as possible ('*' sign)
 split(y) {~UpperFloorHeight : Volume("UF")}*

###############################################################################################################
# volume
###############################################################################################################


Volume(volumeType) -->
 color (colorFunction ( volumeType ))
 MassReporting   # shape for reporting, will be deleted
 MassViz     # shape duplicate for visualization


###############################################################################################################
# viz
###############################################################################################################


MassViz -->
 case vizMode == "massOnly" :
  Viz.
 case vizMode == "massAndFloors" :
  set(material.opacity,0.8)
  Viz.
 case vizMode == "floors" :
  comp(f){ bottom: reverseNormals Viz. }
 else:
  NIL

  

###############################################################################################################
# reporting
###############################################################################################################


MassReporting -->
 comp(f){ bottom:
  report("GFA",geometry.area) 
  report("FAR",geometry.area/plotArea)
  NIL
 }
0 Kudos
MatthiasBuehler1
Frequent Contributor
0 Kudos