question

Yokota T avatar image
0 Likes"
Yokota T asked Yokota T commented

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

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.

FlexSim 22.0.4
flexscriptannimaton
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Yokota T commented

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.


1657520195230.png (13.1 KiB)
1657520229001.png (88.1 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Yokota T avatar image Yokota T commented ·
@Felix Möhlmann Thank you for sharing the useful technique! I'll check the code.
0 Likes 0 ·