Individual extrusions inside a split of a lot?

4142
9
Jump to solution
02-18-2015 12:18 PM
KennethLindhardt
Occasional Contributor

Hi all, I have a issue regarding split inside a footprint.

What I’m doing is, that I’m creating a shapeO on the random Lot’s created from the streetnetwork.

The remainder is going to be first part of a building cluster.

Then I’m doing a offset on street.front/back/left/right, which is going to be the maximum building depth.

Then I’m splitting my offset up in z and x direction randomly, like Matt once wrote:

case scope.sx > 2 * minSize

        split { 'relativeValue : Footprint | 'relativeValue : Footprint| 'relativeValue : Footprint}

    case scope.sz > 2 * minSize

        split(z) { 'relativeValue : Footprint | 'relativeValue : Footprint| 'relativeValue : Footprint}    

    else

        Individual_Footprint

Okay, now to my issue. I need to be able to cut parts of each Individual_Footprint, which basically could be on apartment , and some should be deleted in 20 % of the cases.

The problem is that I’m not able to index my split, so I can randomly create stebacks on each Individual_Footprint, inside a cluster, I can only index it by cluster.

Makes sence?

What I need is a random extrusion and setback on each Individual_Footprint inside a cluster.

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Try this:

attr Building_setback_front = 10

attr Building_setback_back = 10

attr Building_setback_left = 10

attr Building_setback_right = 10

attr Minimum_split = 2

attr Maximum_split = 10

@StartRule

BigLot -->

  alignScopeToAxes(y)

  s('1,0,'1)

  innerRect

  Building_Cluster

Building_Cluster-->

  setback(Building_setback_right) {object.right : Split("z") | remainder :

  setback(Building_setback_left) {object.left : Split("z") | remainder :

  setback(Building_setback_front) {object.front : Split("x") | remainder :

  setback(Building_setback_back) {object.back : Split("x") | remainder : Green_Area}}}}

Split(dir) -->

  case (case dir == "x": scope.sx else: scope.sz) < Minimum_split:

    Extrude

  else:

    split(sel(dir)) {(rand(Minimum_split, Maximum_split)): Extrude | ~1: Split(dir)}

Extrude --> extrude(rand(5,10))

Green_Area --> X.

# Let me know if this works!

# Chris

View solution in original post

0 Kudos
9 Replies
by Anonymous User
Not applicable

Is it possible to sketch this? To illuminate further the intent?

0 Kudos
BenLeslie1
Occasional Contributor III

I think maybe you need to change where you generate the random number.  My guess is that at the moment you have something like this:

attr myRandNo = rand(0,1)

Lot-->

split(x){myRandNo:Lot2}

What I think you need is something like this:

Lot-->

split(x){rand(0,1):Lot2}

I haven't tested this, it could be nonsense.

Alternatively look at the Update Seed tool.

0 Kudos
KennethLindhardt
Occasional Contributor

Hi Ben,

Thank you for your reply. I don’t think that would work, since I’m not able create a “rand” inside a split. If I should do that I would need to create I relative {’rand(0.2,0.8) : Shape} and as far I understand it, this will divide it by a ratio so 0.5 is center.

This is defiantly starting to get to me, I thought I found a solution by using the value as a function, and not as an attr

attr Building_setback_front = 10

attr Building_setback_back = 10

attr Building_setback_left = 10

attr Building_setback_right = 10

height = rand(5,10)

splitter = rand(2,10)

Building_Cluster-->

           setback(Building_setback_right) {object.right : Footprint_2("X") | remainder :

                      setback(Building_setback_left) {object.left : Footprint_2("X") | remainder :

                                 setback(Building_setback_front) {object.front : Footprint_2("Y") | remainder :

                                            setback(Building_setback_back) {object.back : Footprint_2("Y") | remainder : Green_Area}}}}

Footprint_2(Direction_Index)-->

case (Direction_Index) == "X" : X_Split

else : Y_Split

X_Split-->

split(y) {10 : split {~splitter : test}*}

Or similar. I’ve tried all kinds off combinations, but nothing seems to work.

What I would like it do, different values to choose from like:

Splitter =

                             10% : 5

                             10% : 6

Else: 7

And not a rand between, but right now I’m back to zero, and it’s not working. Each side will get the same split value, but it will differ from side to side, that’s the best I can do at the moment.

At this pint I'm talking about the split itself, and not the extrusion 😉

0 Kudos
KennethLindhardt
Occasional Contributor
  1. I’m so stupid L

And sorry for the bad explanation. If I just create a function with 10% : 5 10 % : 6 and so on. And just repeat the split, it will split it randomly according to the function.

Building_Cluster-->

#setback(Building_setback_front) {all : Footprint_2 | remainder : Shape}

           setback(Building_setback_right) {object.right : Footprint_2("X") | remainder :

                      setback(Building_setback_left) {object.left : Footprint_2("X") | remainder :

                                 setback(Building_setback_front) {object.front : Footprint_2("Y") | remainder :

                                            setback(Building_setback_back) {object.back : Footprint_2("Y") | remainder : Green_Area}}}}

Footprint_2(Direction_Index)-->

case (Direction_Index) == "X" :

split {splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test }

else : split(y) {splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test | splitter : test }

          

test-->

case scope.sx <= 4 || scope.sy <= 4 || scope.sx == 5.5 || scope.sy == 5.5 : NIL

else:

extrude(height)

0 Kudos
MatthiasBuehler
Occasional Contributor III

UGLY CODE ALERT !!!

rather use:

split(x) { '0.1: test }*

or something similar.

Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D

-------------------------------------

Garsdale Design Limited

matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

0 Kudos
by Anonymous User
Not applicable

If I'm reading the thread right, then here is an example of random splitting:

@StartRule

RandomSplitExample --> RecursionForRandomSplit

minimumX = 2

RecursionForRandomSplit -->

  case scope.sx < minimumX: Randy

  else: split(x) {(rand(2,10)): Randy | ~1: RecursionForRandomSplit}

#Note: rand function needs parentheses surrounding it as above, or will not compile.

Randy --> color(rand,rand,rand)

RandomSplits.JPG

0 Kudos
by Anonymous User
Not applicable

Also, I'm seeing X and Y splits mentioned above, but if this is a start shape, you probably need X and Z.

My example only covers X.

Chris

0 Kudos
by Anonymous User
Not applicable

Try this:

attr Building_setback_front = 10

attr Building_setback_back = 10

attr Building_setback_left = 10

attr Building_setback_right = 10

attr Minimum_split = 2

attr Maximum_split = 10

@StartRule

BigLot -->

  alignScopeToAxes(y)

  s('1,0,'1)

  innerRect

  Building_Cluster

Building_Cluster-->

  setback(Building_setback_right) {object.right : Split("z") | remainder :

  setback(Building_setback_left) {object.left : Split("z") | remainder :

  setback(Building_setback_front) {object.front : Split("x") | remainder :

  setback(Building_setback_back) {object.back : Split("x") | remainder : Green_Area}}}}

Split(dir) -->

  case (case dir == "x": scope.sx else: scope.sz) < Minimum_split:

    Extrude

  else:

    split(sel(dir)) {(rand(Minimum_split, Maximum_split)): Extrude | ~1: Split(dir)}

Extrude --> extrude(rand(5,10))

Green_Area --> X.

# Let me know if this works!

# Chris

0 Kudos
KennethLindhardt
Occasional Contributor

Exactly Chris, this is what I need. Thank you so much. I modified it a little to choose a couple of standard values, so it will always be in a specific width.

Matt: I had some complication to get the ‘rand to work. I agree it was ugly, and a good thing you pointed that out.

Thanks a lot guys, I’m on my way further…

Cheers!


attr Building_setback_front = 10

attr Building_setback_back = 10

attr Building_setback_left = 10

attr Building_setback_right = 10

attr Minimum_split = 5

attr Maximum_split = 10

Building_width =

           25% :      5.5

           15%:       5

           15% :      6

           20% :      7

           15% :      8

           else :     9


@StartRule

BigLot -->

  alignScopeToAxes(y)

  s('1,0,'1)

  innerRect

  Building_Cluster

Building_Cluster-->

  setback(Building_setback_right) {object.right : Split("z") | remainder :

  setback(Building_setback_left) {object.left : Split("z") | remainder :

  setback(Building_setback_front) {object.front : Split("x") | remainder :

  setback(Building_setback_back) {object.back : Split("x") | remainder : Green_Area}}}}

Split(dir) -->

  case (case dir == "x": scope.sx else: scope.sz) < Minimum_split:

    Extrude

  else:

    split(sel(dir)) {(Building_width): Extrude | ~1: Split(dir)}

Extrude -->

else : extrude(rand(5,10))

Green_Area --> X.

0 Kudos