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.

  1. treenode link = node("..>objectfocus+", c);
  2.  
  3. // Read the label on the queue
  4. string itemName = link.Create;
  5. // Create item in model
  6. Object item = createinstance(Model.find("Tools/FlowItemBin/" + itemName + "/1"), model());
  7. // Move item into queue
  8. 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.

  1. treenode link = node("..>objectfocus+", c);
  2.  
  3. string itemName = "";
  4. string itemCode = link.Create;
  5. if(itemCode == "B11") {
  6.     itemName = "Box";
  7. }
  8. if(itemCode == "P22") {
  9.     itemName = "Pallet";
  10. }
  11.  
  12. if(itemName != "") {
  13.     Object item = createinstance(Model.find("Tools/FlowItemBin/" + itemName + "/1"), model());
  14.     moveobject(item, link);
  15. }

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.