Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What's the python comand toswitch to a certain item of a switchnode?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
707 Views, 3 Replies

What's the python comand toswitch to a certain item of a switchnode?

What's the python comand toswitch to a certain item of a switchnode?

 

e.g. switch to the 3rd item "255_40_9.0x20" of node "***Tire***"

 

switch.JPG

3 REPLIES 3
Message 2 of 4
richardlevene
in reply to: Anonymous

I do not know all the possibilities with the python in vred (I am sure one of the devs can help better) but I know for sure you can just create variantSets  for each tire option to be visible then just use selectVariantSet command to select the variantSet that shows the tire you desire.

 

selectVariantSet(name, excludeViewpoint)

Activates a variant set. The variant set will activate all states of its defined node and material variants.
Parameters:
name - The name of the variant set.
           (type=string)
excludeViewpoint - exclude viewpoint from this variant set.
           (type=bool)

There is a vrSwitch python node but the example in the python docs doesn't seem to show you can explicitly call a particular option within a switch. Just toggle. Probably doable though but beyond my level now.

 

Richard

Message 3 of 4
dlincol1
in reply to: Anonymous

s = findNode('***Tire***')

s.fields().setInt32("choice", 2)

 

The first child of a switch is 0, so 2 is item 3 from your example.

Open the Node Editor for a Switchnode to see the choice attribute.

Regards,
Dan
Message 4 of 4
Anonymous
in reply to: dlincol1

Super!

 

That works perfect!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report