How can I add a new sub-component in the animation editor by FlexScript?

How can I add a new sub-component in the animation editor by FlexScript?

yokota_t
Not applicable
5 Views
2 Replies
Message 1 of 3

How can I add a new sub-component in the animation editor by FlexScript?

yokota_t
Not applicable

[ FlexSim 22.0.4 ]

Hello all,

I would like to use a script to do the same thing as pressing this button.

add-a-new-sub-component.png

How can I do this?

Thank you.

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

moehlmann_fe
Observer
Observer
Accepted solution

For many windows you can do the following to see what code is executed when pressing buttons. Rightclick somewhere in the respective GUI and choose 'View' -> 'Explore Structure'. This will open the tree view of that window, where you should be able to find the relevant part of the GUI and see its attached code.

1657520195230.png

1657520229001.png

Many of the functions there probably won't be necessary when you add a component via code (like the undo management, setting the object as selected and repainting the window). The relevant parts here are line 3, where the drawsurrogate node of the object is referenced and line 11 where an object is created inside of it.

0 Likes
Message 3 of 3

yokota_t
Not applicable
@Felix Möhlmann Thank you for sharing the useful technique! I'll check the code.
0 Likes