question

Sam avatar image
0 Likes"
Sam asked Jeanette F commented

OpenModel and OpenRecentModel

Hi. I want to modify the code inside MAIN:/project/exec/globals/nodefunctions/menucommands/File/openmodel and MAIN:/project/exec/globals/nodefunctions/menucommands/File/openrecentmodel. I did a replace of the node my the custom module.

I added the following line of code to openmodel and openrecentmodel.

int userresponse = msg(getapplicationtitle(), "Model was saved with module version ", 1);


If I open the model from the flexsim splash screen, open recent, or file -> open model. The code above gets executed.

If open my model by double clicking it from windows explorer or dragging the model to the flexsim.exe icon then the alert box does not pop up.


Does flexsim use openmodel and openrecentmodel when using the double click on a FSM file?

FlexSim 23.0.15
customcodemodules
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Sam, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

1 Like 1 ·

1 Answer

Jordan Johnson avatar image
4 Likes"
Jordan Johnson answered

FlexSim doesn't use openmodel or openrecentmodel when double clicking. In that case, the model is passed as a command line argument. The commands you reference are only in response to user actions once the software is opened.

I think a better place for you to modify is in MAIN:/project/events/OnOpenModel. All of these scripts are executed in order when any model is opened, whether through the menu or double clicking. You can have your module just add a script at the end of the list. This has the advantage that additions are much easier to maintain than replacements.

5 |100000

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