Matching object's front elevation with a street segment | inscribed rectangle

365
0
10-06-2021 06:15 AM
Labels (1)
aginside_out
New Contributor

Hello, 

I hope that the image clearly shows what I have been trying to do. 

-> I have an urban block, divided into separate lots, and would like the buildings to be created on each so that the front elevation matches the street segment orientation. 

So far, I tried with this piece of a code: 

BaseArea -->
reverseNormals()

innerRectangle(scope) {shape : Lot |
remainder = JustGround}

 

### Rules

@StartRule

# divide the block into 2 parts: Lot and JustGround.
BaseArea -->
reverseNormals()

innerRectangle(scope) {shape : Lot |
remainder = JustGround}


Lot -->
case isBuildingType(0):
print("total area = " + geometry.area)
splitArea(x) { ~1 : splitArea(z) { '0.5 : Red
| '0.5 : Yellow }
| ~1 : splitArea(z) { '0.5 : Turqoise
| '0.5 : Cyan }
| ~1 : splitArea(z) { '0.5 : Blue
| '0.5 : Magenta }
}
case isBuildingType(1):
print(geometry.area)
splitArea(z) { '0.5 : Pink
| '0.5 : Blue }
else:
print("total area = " + geometry.area)
splitArea(z) { '1 : Pink }

Red --> // red
BuiltupArea
//SHOP

Yellow --> // yellow
BuiltupArea
//HOUSE

Turqoise --> // green
Garden
//GREENERY

Cyan --> // cyan
BuiltupArea
//HOUSE

Blue --> // blue
BuiltupArea
//HOUSE

Magenta --> // magenta
BuiltupArea
//HOUSE

Pink --> // semi-transparent pink
BuiltupArea
//HOUSE


# Divide BuiltupArea into an O shape: the area of O shape is FootageA; the remainder is Garden.
BuiltupArea -->

shapeO(FrontDepth,RightWidth,BackDepth,LeftWidth) {shape: FootageA|remainder: Garden}

FootageA -->
split(x){~15:FootageB|{~8:FootageC|~15: FootageB}*}

# split FootageB by z axial into 2 parts: FootageD and FootageE. FootageE is the OutHouse. FootageD is the Building.
FootageB -->
split(z){~10:FootageD|{~5:FootageE|~10: FootageF}*}

FootageC -->
Garden

# extrude FootageE
FootageE -->
case FloorNumber > 1 :
extrude(FloorHeight)OutHouse
else : Garden

# extrude FootageD
FootageD -->
case FloorNumber < 2 : Ground
case FloorNumber > 3 :
extrude(FloorHeight)Building
else : extrude(Height-FloorHeight)Building

# extrude FootageD
FootageF -->
extrude(Height)Building

 

...and the script goes on. I have read about two options of fitting the rectangle (that is meant to be the building footprint) into a polygon (which is the shape of my lots) -> innerRectangle(scope)  and innerRectangle(edge). I do wonder whether there is any other solution that I may apply to the project.

Have a nice day! 

0 Kudos
0 Replies