Notifications
Clear all
[Closed] Using a Variable for selections
Feb 17, 2014 12:19 am
Hi all,
Not sure if this is possible, and I wasnt sure what to search for.
Basically what Im trying to do is use a Variable for object selections
So for example
ColourVar is a variable.
There are two objects
$Green_Sphere
$Red_Sphere
Say I want to select all green objects Id go
$Green*
But is it possible to use a Variable like this
$ColourVar*
So that I can switch what my script effects without having to go in and switch between red and green.
Or is there a better way of doing this??
Thanks!
4 Replies
Feb 17, 2014 12:19 am
my suggestion: choose what you like
#1 data pairs method
ColourVar = dataPair greens:$Green* reds:$Red*
-- select red spheres
select ColourVar.reds
-- select green spheres
select ColourVar.greens
#2 struct method
struct cv (reds, greens)
ColourVar = cv greens:$Green* reds:$Red*
-- select red spheres
select ColourVar.reds
-- select green spheres
select ColourVar.greens
#3 array method
ColourVar = #($Green*,$Red*)
-- select red spheres
select ColourVar[2]
-- select green spheres
select ColourVar[1]
Feb 17, 2014 12:19 am
I think tat dataPairs in this case is most suitable. But if he need more options then 2nd and 3rd option is better choise. Oops I forgot to mention 4th 🙂
Feb 17, 2014 12:19 am
Thanks! really appreciate the extra examples, very handy to know they exist, I’m still learning!
Much appreciated!