How to convert 'ShapeO' to 'SetbackToArea'

108
0
12-19-2021 04:40 PM
JINHWANJUN
New Contributor

Hi, im student of Urban Planning & Design.

i got CGA Rule file. that makes each floor building setback.

but, this rule contains ShapeO Operation. 

ShapeO Operation work with setback distance.

but, i don't fix setback distance exactly.

Instead of a distance, I want to setback a certain area(through SetbackToArea).

In the ShapeO Operation Doc, maybe ShapeO can convert setback option.

https://doc.arcgis.com/en/cityengine/latest/cga/cga-shapeo.htm

i tried through this Doc, but i failed to convert.

So, i wanna change How to convert 'ShapeO' to 'SetbackToArea'.

I will attach it below 'ShapeO' original CGA Rule File Code.

#####################################################################################
# ATTRS
#####################################################################################


@Group("BUILDING",0) @Order(0)
attr nFloors = 15
@Group("BUILDING") @Order(1)
attr groundFloorHeight = 5.5
@Group("BUILDING") @Order(2)
attr upperFloorHeight = 3.5
@Group("BUILDING") @Order(3)
attr volumeChange_1_floor = 2
@Group("BUILDING") @Order(4)
attr volumeChange_2_floor = 5


@Group("1",1) @Order(0) @Range(0,5)
attr frontSetback_1 = 0
@Group("1") @Order(1) @Range(0,5)
attr backSetback_1 = 5.9
@Group("1") @Order(2) @Range(0,5)
attr sideSetback_1 = 0

@Group("2",2) @Order(0) @Range(0,5)
attr frontSetback_2 = 0
@Group("2") @Order(1) @Range(0,5)
attr backSetback_2 = 0
@Group("2") @Order(2) @Range(0,5)
attr sideSetback_2 = 0

@Group("3",3) @Order(0) @Range(0,5)
attr frontSetback_3 = 5
@Group("3") @Order(1) @Range(0,5)
attr backSetback_3 = 0
@Group("3") @Order(2) @Range(0,5)
attr sideSetback_3 = 2


#####################################################################################
# FUNCTIONS
#####################################################################################


floorHeightFunction(floorID) =
case floorID == 1:
groundFloorHeight
else :
upperFloorHeight

setbackID (n) =
case n >= rint(volumeChange_2_floor) :
3
case n >= rint(volumeChange_1_floor) :
2
else :
1

setbackDimension (n, side) =
case setbackID(n) == 3:
case side == "front" : frontSetback_3
case side == "back" : backSetback_3
else : sideSetback_3
case setbackID(n) == 2:
case side == "front" : frontSetback_2
case side == "back" : backSetback_2
else : sideSetback_2
else :
case side == "front" : frontSetback_1
case side == "back" : backSetback_1
else : sideSetback_1


#####################################################################################
# START
#####################################################################################


@StartRule
Shape -->
BuildingRecursion(1) # start with floor '1' = ground floor


BuildingRecursion(n) -->
case n > rint(nFloors) :
NIL

else :
extrude(world.y, floorHeightFunction(n))
FloorVolume(n)

# back to recursion
comp(f) {top : BuildingRecursion(n + 1)}


FloorVolume(n) -->
comp(f) {bottom:
reverseNormals
alignScopeToAxes(y)

shapeO(setbackDimension (n, "front"),
setbackDimension (n, "side"),
setbackDimension (n, "back"),
setbackDimension (n, "side"))
{shape : NIL |
remainder : extrude(world.y, floorHeightFunction(n))
Floor.}}

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

 

P.s What's mean 'Floor.' ? i don't understand why 'Floor.' is there. 

I'd really appreciate it if you could answer.

 
 

 

0 Kudos
0 Replies