Code lines for doing animation.

Code lines for doing animation.

sri_vikas_k
Not applicable
51 Views
5 Replies
Message 1 of 6

Code lines for doing animation.

sri_vikas_k
Not applicable

[ FlexSim 23.0.3 ]

Hi Cammunity.

In my model i am using a code to make an object run an animation.

if (buttonNum == 8)

{

Model.find("Door");

}

if (buttonNum == 9)

{

Model.find("Door");

}

What is the complete code lines for this.

Thankyou

0 Likes
Accepted solutions (1)
52 Views
5 Replies
Replies (5)
Message 2 of 6

sri_vikas_k
Not applicable

It is showing some error like this.error-in-code.png

0 Likes
Message 3 of 6

moehlmann_fe
Explorer
Explorer
Accepted solution

In your screenshot you are mixing up two ways to access the animation.

You can either use the old commands (startanimation, stopanimation, ...) which you can look up in the command help within FlexSim directly (Help -> Command Helper).

1676112634526.png

Or you the newer "animations" class. Information about that is available in the class reference section of the online manual.

https://docs.flexsim.com/en/23.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Animation.htm...

If you need to look up syntax in general, those two sources will help you in most cases.

Message 4 of 6

sri_vikas_k
Not applicable

I have tried in that way also, but it is still showing the error.

error-window.png

0 Likes
Message 5 of 6

moehlmann_fe
Explorer
Explorer
Try placing "as(Object)" after "Model.find()" like in the 7 an 11. This tells FlexSim what to interpret the node as.
0 Likes
Message 6 of 6

joerg_vogel_HsH
Mentor
Mentor

@Sri_vikas K, “find” method is of a flexscript class treenode. The class “animation” is a sub class of class Object. Felix showed a method of casting from one class to another class.

0 Likes