Applying a split across a building regardless of previous splits

2330
3
Jump to solution
10-16-2014 08:47 AM
LR
by
Regular Contributor

I created a building using vertical splits because some elements (the entrance part) didn't line up with the rest and to keep the number of splits to a minimum. However, now I'd like to split the building horizontally to color its floors separately. Is that possible while retaining the current structure?

Here's a photoshop mockup of what I'm trying to do:

mock.jpg

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Here's one way to do it:

version "2014.1"

attr floorCount = 4

attr floorHeight = 4

Shape -->

  extrude(floorCount * floorHeight)

  SplitIntoFloors

SplitIntoFloors -->

  split(y) {floorHeight: Floor}*

Floor -->

  comp(f) {side: Facade(split.index)}

Facade(floorIndex) -->

  case floorIndex == 0: color(1,0,0) FacadeVerticalSplits(true)

  else: color(0,1,0) FacadeVerticalSplits(false)

FacadeVerticalSplits(isGroundFloor) -->

  split(x) {

  '0.4: VerticalSplittingLeft |

  '0.2: EntranceOrWindows(isGroundFloor) |

  '0.4: VerticalSplittingRight

  }

EntranceOrWindows(isGroundFloor) -->

  case isGroundFloor: Entrance

  else: EntranceWindows

Entrance --> YourOldCodeHereForGroundFloor.

EntranceWindows --> YourOldCodeHereForWindowsAboveEntrance.

VerticalSplittingLeft  --> YourOldCodeHereForLeftSide.

VerticalSplittingRight --> YourOldCodeHereForRightSide.

View solution in original post

0 Kudos
3 Replies
by Anonymous User
Not applicable

Here's one way to do it:

version "2014.1"

attr floorCount = 4

attr floorHeight = 4

Shape -->

  extrude(floorCount * floorHeight)

  SplitIntoFloors

SplitIntoFloors -->

  split(y) {floorHeight: Floor}*

Floor -->

  comp(f) {side: Facade(split.index)}

Facade(floorIndex) -->

  case floorIndex == 0: color(1,0,0) FacadeVerticalSplits(true)

  else: color(0,1,0) FacadeVerticalSplits(false)

FacadeVerticalSplits(isGroundFloor) -->

  split(x) {

  '0.4: VerticalSplittingLeft |

  '0.2: EntranceOrWindows(isGroundFloor) |

  '0.4: VerticalSplittingRight

  }

EntranceOrWindows(isGroundFloor) -->

  case isGroundFloor: Entrance

  else: EntranceWindows

Entrance --> YourOldCodeHereForGroundFloor.

EntranceWindows --> YourOldCodeHereForWindowsAboveEntrance.

VerticalSplittingLeft  --> YourOldCodeHereForLeftSide.

VerticalSplittingRight --> YourOldCodeHereForRightSide.

0 Kudos
by Anonymous User
Not applicable

But if you do it that way, you must be OK with the vertical section over the entrance being slightly different as in below image:

mock2.jpg

0 Kudos
LR
by
Regular Contributor

Hmm that's what I wanted to avoid.. but I guess it's probably better to just rewrite the script and do the coloring like in your example. Thanks!

0 Kudos