question

Sharan Nitin avatar image
0 Likes"
Sharan Nitin asked Jason Lightfoot edited

How to add "trigger" codes in User Library?

FlexSim 18.1.2
simulationdevelopmenttrigger
· 2
5 |100000

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

Sebastian Hemmann avatar image Sebastian Hemmann commented ·

Are you looking for a way to take the whole Code of a trigger and add it to a user library? So you could store the library and open it in another model?

The best way to do something like this would be to add your code to a User Command. You can just call the User Command in your trigger and you can add it to the library very easy.

0 Likes 0 ·
Sharan Nitin avatar image Sharan Nitin Sebastian Hemmann commented ·

Hello sebastian.hemmann , I could not find a way to add trigger codes in the User Library. Need help on this. Thanks..!!

0 Likes 0 ·

1 Answer

·
tannerp avatar image
1 Like"
tannerp answered Jason Lightfoot edited

Try adding it by clicking on the icon shown below and then selecting the User Library to which you'd like to add it. Hopefully this helps:

It will show up in your Library and you can edit and load these libraries in your model.


· 5
5 |100000

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

Sharan Nitin avatar image Sharan Nitin commented ·

Need to add these codes in the Library.Tanner Poulton ..!!

0 Likes 0 ·
capture.jpg (10.5 KiB)
tannerp avatar image tannerp Sharan Nitin commented ·

Like @sebastian.hemmann mentioned, you should do the following:

1) Copy the code from your Model Triggers into a User Command (here it's named MyCustomTrigger):

2) Call your User Command in your Model Trigger:

This way, your code is stored in the User Library, but you can access it with model triggers inside each of your models. It's kind of a workaround instead of directly adding the model trigger to the library, but the model trigger is just for your model, so it makes sense to add a global code block to the library instead of a local one.

0 Likes 0 ·
Sharan Nitin avatar image Sharan Nitin tannerp commented ·

Hello Tanner..!! I completely understood your point. But suppose we create a user command for OnRunStop and save it in User Library. Where you will call this command to make the code executed (OnRunStop)?


FYI: Also, I don't want to add the OnRunStop code manually anywhere, but want it to pop up automatically at its place after the installation of the library.

Hope my question is clear to you people.

0 Likes 0 ·
Show more comments

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.