question

Skovdestudents avatar image
0 Likes"
Skovdestudents asked Skovdestudents commented

UserEvent, run outside simulation run only once

Hello I would like to run a User Event only once, I have a function that builds a 3d model with objects size, location etc. I want to run this only one time to create the virtual model. I guess its possible to have a processflow that does all this and then "disconnect" it. But this processflow/model is supposed to be used several times for several projects so it would be nice if there is a way to run this processflow by "choice". By writing a i.e "CreateModel" or a button, etc.


Right now I run this on simulation starts and all works as intended but I need to manually change the processflow after my first run to not clear and rebuild the model every consecutive run.

regards

FlexSim 23.0.5
uservent
· 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 @Skovdestudents, was Joerg Vogel'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 unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Skovdestudents commented
You can let execute a script on a loading event. A condition can be set, that it gets evaluated only if a tree node value allows it. If this script has been done, you set this node value to disallow any further execution.

You can also put the script into a treenode in an object, that you control by flags to hide it visually and make it not selectable.

· 3
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 Jason Lightfoot ♦♦ commented ·

Use the OnModelOpen trigger to do as Jörg suggests.

1680173028813.png

1 Like 1 ·
1680173028813.png (13.1 KiB)
Lars Jacobsen avatar image Lars Jacobsen commented ·
You can also add a button to a dashboard and assign the code to this button
0 Likes 0 ·
Skovdestudents avatar image Skovdestudents commented ·
We solved it by reading a condition from a table with a codesnippet in Process Flow, we did not fully solve it with this way
0 Likes 0 ·