question

VikSin avatar image
0 Likes"
VikSin asked VikSin commented

Custom commands in FlexSim user library

Hello,

It's possible to add custom commands to user library ? Also, as we write different custom commands across different models, I was thinking to put all these commands to one big user library and just call these commands from it. Is it possible ?

FlexSim 23.2.2
user librarycustom commands
5 |100000

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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered VikSin commented

You can by default add your model user commands to a user library either to be installed in your model or drag dropped into the model:

1699622155678.png

However, at the moment if you add a command twice you can get two versions in the user library, so you'll need to manually prune the tree of the old one.

You can set FlexSim to automatically load a user library so you always have access to them from the global preferences.

1699622273864.png


You can also put the commands under a custom node of the user library and create the modellibraries structure to refer to those commands when you load the library or create a new model (using the dropscript method Felix mentions). Once under a custom node they will probably not be editable from the UserCommands editor and so you'll likely need to edit the tree to update your shared commands.

To manage a shared user library of commands you'd probably want to save it as xml and merge any changes in a version control system. To make this work with the least manual merge intervention, you'd could sort the node that holds all the user commands alphabetically, or create a .ffm map file that splits out each user command as its own xml. That requires creating a dynamic .ffm which could be part of a scripted custom button you press to save the commands out. At the moment I don't think there's a standard user library pre-save hook for you to do that automatically every time you save the library.



1699622155678.png (31.9 KiB)
1699622273864.png (8.7 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.

VikSin avatar image VikSin commented ·

Thank you, that's perfect :)

0 Likes 0 ·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

Theorically, you can add to/manipulate the model tree in any way you like using a custom dropscript for a user library object.

A little further down on the page there is an explanation of special ways you can make user commands accessible in the model without visibly adding them to the toolbox or even while leaving them entirely inside the library only.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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