User command Question

User command Question

s1125413
Advocate Advocate
91 Views
2 Replies
Message 1 of 3

User command Question

s1125413
Advocate
Advocate

Hello FlexSim forums and @moehlmann_fe  ,

Because there is a lot of repeated code serving the same functionality in my main code, I would like to move those parts into a User Command and call it from the main code to simplify the overall structure.

 

In this logic, I record the object numbers for conveyor and non-conveyor objects, and store them in the variables ProcNum and ConveyorNum, which are then used later in the main code.

However, I am not very familiar with using User Commands yet (as shown in the picture below). Are there any recommended methods or best advise to implement this?

 

Thank you in advance.

s1125413_0-1777346979667.png

 

0 Likes
Accepted solutions (1)
92 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Collaborator
Collaborator
Accepted solution

It looks like the only parameter the code needs is the info table. You access parameters in the command code through "param(N)", where N is the position in the parameter list.

The two values would be returned as an array. You can then assign the result to individual variables if you want.

Screenshot 2026-04-29 101036.png

https://docs.flexsim.com/en/26.0/Reference/Tools/UserCommands/UserCommands.html

0 Likes
Message 3 of 3

s1125413
Advocate
Advocate

@moehlmann_fe Thank you so much, this is a perfect example for me to learn from and to make use of User Commands!

0 Likes