question

Wang Z2 avatar image
0 Likes"
Wang Z2 asked Wang Z2 commented

Calling user commands in the GUI interface

In my model ,I want to trigger the User command after pressing the button in GUI.

In pic,I also want to assign the input parameters to some of the parameters in the user command.

For example,I want input "90" in the first blank,and assign it to the "number"(row 5 in User command).

How can i achieve it?

Thanks a lotgui-to-user-command.fsm

FlexSim 18.2.2
guiuser commandbutton
pic.jpg (1.7 KiB)
5 |100000

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

1 Answer

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Wang Z2 commented

You can add nodes at the user command that store number data. You use GUI edit fields to set node value, which you evaluate in the user command to resize or set the location of the rack.

Highlight the command node icon. Press return key. This inserts a node in the subtree. Rename the node for example to "myVar2".

Highlight the node icon of myVar2 Right Mouse Button to open the context: Choose Node > Add Number Data .

Change the data to another value 3.4.

Reset the model.

source code to print the number data of the inserted nodes "myVar1" and "myVar2" ín the user command:

print(c.up.subnodes["myVar1"].value,"  ",c.up.subnodes["myVar2"].value);

· 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.

Wang Z2 avatar image Wang Z2 commented ·

Thanks a lot !

It worked

0 Likes 0 ·
Wang Z2 avatar image Wang Z2 commented ·

I have meet another problem

Now,I want trigger the User command to create racks,I verified the correctness of creating racks code in the script console.

And set the "start" control (pic1),but it doesn't work

0 Likes 0 ·
pic1.jpg (6.2 KiB)

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.