Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Switch Between V-Set with one Touch Sensors

a.melbourne01
Enthusiast

Switch Between V-Set with one Touch Sensors

a.melbourne01
Enthusiast
Enthusiast

hello,

 

I need a way of switching between V-set with just one Touch Senors. Is there a way of doing this with Scripting or another way of doing these that im not aware of? 

 

Thanks Andy

0 Likes
Reply
Accepted solutions (1)
786 Views
6 Replies
Replies (6)

j.kaestle
Enthusiast
Enthusiast

Hello,

If I got it right, it should be possible with scripting.

You can define a V-Set for the touch sensor with this Python command:

selectVariantSet(V-Set-Name)

where V-Set-Name is a variable with the Name of the V-Set you want to call. The Name can be defined by some other Code. So it's possible to call different V-Sets with one Touch Sensor. E.G. by iterating a list with V-Set Names.

 

Hope this helps

 

Regards Jochen

 

0 Likes

a.melbourne01
Enthusiast
Enthusiast

Hi Jochen, 

 

Thank you for getting back to me.

 

I`m complete new to scripting do you have an example of what the script would look like to achieve these?

 

Thanks 

Andy

0 Likes

guillaume_juif
Participant
Participant
Accepted solution

Hi Andy,

I'm not an expert in python, but something like this in a variantSet can do the trick

listLengh = len(VSetList)

if i < listLengh:
    vSet = VSetList[i]
    print vSet
    selectVariantSet(vSet)
    i = i+1

elif i == listLengh:
    i = 0
    vSet = VSetList[i]
    print vSet
    selectVariantSet(vSet)
    i = i+1

it's probably not clean

 

and you add this to your script editor

VSetList = ["Variant 1", "Variant 2", "Variant 3"]
i = 0

just replace by your variantSets names and add some if you need.

 

Hope it can help

0 Likes

a.melbourne01
Enthusiast
Enthusiast

Thank you,

 

That works great. The only problem that im having is that the first time i use it when opening my file, it takes along time to work then after the first time it works great. Im having the same problem with all the script i run.

 

Do you know of any good website to learn about scripting in Vred? I want to get my head around it but i have no idea where to start.

 

Andy

0 Likes

guillaume_juif
Participant
Participant

Strange, I don't have any problem with it.

Try to open the simple scene i've join and execute the New Variant 1 to see if you have Variant 1 2 or 3  return in the Terminal.

If it works great at first execution, it probably come from you data.

0 Likes

a.melbourne01
Enthusiast
Enthusiast

Hi Guillaume Juif,

 

Thank you again for your help with the variantSet script, i have another question tho. If i need to used it more then once in a scene, what will i need to change in the script so it can recognize the different lists? 

 

Thank you,

 

Andy

0 Likes