Stochastic Rule on Heigh

1771
1
10-29-2014 04:40 AM
IonutAlixandroae
Occasional Contributor

Hello,

I have defined an "Height" attribute which has 3 specific values.

I want to create a stochastic rule that would give me 33% percent of each height when applied on buildings.

Could someone help me with managing this problem? I tried creating a 'case-else' rule on "height" but it doesn`t seems to be correct...

Eg.

@Range (Random="random", Floor1=5, Floor2=10, Floor3=15)

attr Height = "random"

Building -->

  extrude(world.y, Height)

  Mass

const function_Height =

  case Height == "random" :

  33% : 5

  33% : 10

  else : 15

0 Kudos
1 Reply
by Anonymous User
Not applicable

1. Range has mixed data types. Since random is a string, all must be string. Change to:

@Range (Random="random", Floor1="5", Floor2="10", Floor3="15")

2, extrude command should use constant function_Height, not attribute Height. Change to:

extrude(world.y, function_Height)

3. The constant function_Height needs a matching else for the case statement. The else you have now applies to the stochastic structure and not the case. Also the extra else now needs a float function, since your Height attribute is a string and not a float. Change to:

const function_Height =

  case Height == "random" :

  33% : 5

  33% : 10

  else : 15

  else: float(Height)