Ability to use conditional command (case and else) in @Range annotaion

2268
10
03-14-2021 08:13 PM
maziaryousefi
New Contributor

Hi, is there a way to do this when i select an option from the Scenario_Type attribute then only its subset appears in the SubScenario_Type attribute.In other words when i select A in Scenario_Type attribute Only appear A1 ,A2,A3 in SubScenario_Type attribute . also for B and C

 

@Range("A","B","C")
attr Scenario_Type ="A"


@Range("A1","A2","A3","B1","B2","B3","C1","C2","C3")
attr SubScenario_Type =""

 

Parcel-->
extrude(rand(5,25))
Building

 

Building -->
case Scenario_Type =="A" :
case SubScenario_Type =="A1" :
color(1,0,0)
case SubScenario_Type =="A2" :
color(0.5,0,0)
else :
color(0.3,0,0)

case Scenario_Type =="B" :
case SubScenario_Type =="B1" :
color(1,1,0)
case SubScenario_Type =="B2" :
color(1,0.4,0)
else :
color(1,0.6,1)


else :

case SubScenario_Type =="C1" :
color(0,1,0)
case SubScenario_Type =="C2" :
color(0,0.5,0)
else :
color(0,0.3,0)

 

#-----------------------------------------------------------

for example :
#---


@Range("A","B","C")
attr Scenario_Type ="A"


@Range(case Scenario_Type =="A" :"A1;A2;A3" case Scenario_Type =="B" :"B1;B2;B3" else :"C1;C2;C3" )
attr SubScenario_Type =""

 

Parcel-->
extrude(rand(5,25))
Building

 

Building -->
case Scenario_Type =="A" :
case SubScenario_Type =="A1" :
color(1,0,0)
case SubScenario_Type =="A2" :
color(0.5,0,0)
else :
color(0.3,0,0)

case Scenario_Type =="B" :
case SubScenario_Type =="B1" :
color(1,1,0)
case SubScenario_Type =="B2" :
color(1,0.4,0)
else :
color(1,0.6,1)


else :

case SubScenario_Type =="C1" :
color(0,1,0)
case SubScenario_Type =="C2" :
color(0,0.5,0)
else :
color(0,0.3,0)

















 

 

0 Kudos
10 Replies
hadiyousefi
New Contributor II

dear BrianWamsley thank you very much for your helpful answer

0 Kudos