Using an attribute in place of the percentage for a stochastic rule

1724
3
09-27-2012 02:16 AM
ElliotHartley
Occasional Contributor
I was wondering whether there was a way of allowing the use of an named attribute, say "parking_occupancy" in the stochastic rule.

Instead of :

20% : placecar
else: NIL

I could use (I know this doesn't work, but you get the idea)

attr parking_occupancy = 25

parking_occupancy% : placecar
else : NIL

This would mean I could adjust the variable in the inspector and not the rule file... am I missing something obvious? Is there a workaround?
0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor II
sure possible !


case p(0.25) :
    DoThis.
else :
    DoThat.
0 Kudos
ElliotHartley
Occasional Contributor
Thank you Matthias,

It's all so obvious now... It's a wonder I tie my shoe laces in the morning sometimes.... :)

Elliot

sure possible !


case p(0.25) :
    DoThis.
else :
    DoThat.
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Haha... If you weren't able to, you'd still have some time left to learn until you have to teach it to your youngest .. ;)

[ both CityEngine and shoe laces .. ]
0 Kudos