Play pause animation with a single variant (Setting a single hotkey) usign python

Play pause animation with a single variant (Setting a single hotkey) usign python

fabiodimperio
Participant Participant
1,562 Views
21 Replies
Message 1 of 22

Play pause animation with a single variant (Setting a single hotkey) usign python

fabiodimperio
Participant
Participant

Hi everybody!

I tried the script in "Script Editor":

 

isPlaying = False

isPausing = False

 

def myPlayToggle():

global isPlaying

global isPausing

 

if not isPlaying:

playCAnimation("Insieme")

isPlaying = True

 

else:

isPausing = not isPausing

pauseCAnimation("Insieme", isPausing)

 

Once I do double click on the Variant is not running.

And the promp write the message:

File "<string>", line 1, in <module>

NameError: name 'myPlayToggle' is not defined

 

Can someone help me?

I attach the sample file.

 

Thank you

fabiodimperio_0-1666691843194.png

0 Likes
Accepted solutions (1)
1,563 Views
21 Replies
Replies (21)
Message 21 of 22

Christian_Garimberti
Advisor
Advisor
Accepted solution

The same place where you put the resetCAnimation. I suppose you already have it in the script editor, but not in the variantset.

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 22 of 22

fabiodimperio
Participant
Participant
Perfect 😄 I put it in varset. Now it works! Thank you so much!
0 Likes