question

Anutt K avatar image
0 Likes"
Anutt K asked Jason Lightfoot commented

How to get Model Input to use for Create Item ?

1657529550882.png

Hello, I want to use text to condition for Create Item in 3D.
How can i use "Edit" in dashboards library when it like a text box for get text input and use for Trig 2D Process Flow to do Create Item in 3D. Or can I use other solution.

Example :

text input : B11 to create Box.

text input : P22 to create Pallet.

So,or you have some other solution. You can sharing with here. Thank You Very Much

FlexSim 22.1.3
data importeditinput value
1657529550882.png (224.3 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

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jason Lightfoot commented

You could create an item directly in the 'On Apply' code of the edit field, so it would probably be more convenient to add a button to the dashboard that does this.

First, link the edit field to a node in the model. In the attached model I used a label on Queue1 for this. Now other parts of the model can access the value in the field through that node.

I linked the button to the queue (for an easy reference to the label and because I want to create the item in the queue). In its 'OnPress' code I then create an instance of an object in the FlowItem Bin with the same name as the text in the edit field.

treenode link = node("..>objectfocus+", c);

// Read the label on the queue
string itemName = link.Create;
// Create item in model
Object item = createinstance(Model.find("Tools/FlowItemBin/" + itemName + "/1"), model());
// Move item into queue
moveobject(item, link);

If you dont want to use the name (or rank) of the flowitem directly, you can of course write if-conditions such as the following, to determine the correct item type.

treenode link = node("..>objectfocus+", c);

string itemName = "";
string itemCode = link.Create;
if(itemCode == "B11") {
    itemName = "Box";
}
if(itemCode == "P22") {
    itemName = "Pallet";
}

if(itemName != "") {
    Object item = createinstance(Model.find("Tools/FlowItemBin/" + itemName + "/1"), model());
    moveobject(item, link);
}

CreateItem_Dashboard_fm.fsm


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

Anutt K avatar image Anutt K commented ·

Thank You. It work well.

1657596750693.png

I will get your guid to make input for Model.

0 Likes 0 ·
1657596750693.png (295.1 KiB)
Anutt K avatar image Anutt K commented ·

And I have one question.

1657597089710.png

What should I do ?

If I want to clear text in edit field when I click the button "Create in Queue".

What command code do I have to write in 'OnApply' of edit field or write in 'OnProcess' of Create in Queue button ?







0 Likes 0 ·
1657597089710.png (8.4 KiB)
Felix Möhlmann avatar image Felix Möhlmann Anutt K commented ·

Since the label is linked to the edit field, you only have to reset it to an empty string after creating the item in the 'OnPress' of the button.

link.Create = "";
0 Likes 0 ·
Anutt K avatar image Anutt K Felix Möhlmann commented ·

OK. Thank You so much. It work.

And now I wonder. Will it be possible ?

If when edit field have a text (OnApply) it will create Item and text in edit field are clearing (Auto Create).

Such as edit field get a text and I will coding to " delay(300); " then Item will arrive and passing 0.3 sec edit field will clear text inside.

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.