ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Copy Labels
Hi everyone!
I would like to copy all labels from a container (pallet) to individual items during model run. I tried following code, but it might not the correct way. Could anyone help me? By the way, the individual items don't have labels defined yet. In other words, I would like to dynamically defined the labels same as the container and assing the value from a container at the same time. containerplt --> pallet object --> several labels are defined and have values. rank(containerplt, i) --> individual item --> No labels are defined yet PltSize --> number of items on a pallet for(i = 1; i<=PltSize; i++){ copylabels(rank(containerplt, i), containerplt); } Thanks in advance. I use v 4.3. Last edited by Sung Kim; 06-04-2008 at 08:38 AM. |
#2
|
||||
|
||||
Sung,
The copylabels command copies the labels from the specified object to all of the selected objects in the model. You might want to go to the help menu and look up a command in the command documentation before you try to implement it. The code that you tried to use could have had very bad consequences in your model. Try the following code in your model to copy all of the labels from one object to another: treenode fromobj = (YOU DEFINE); treenode toobj = (YOU DEFINE); int index; for(index = 1; index <= content(labels(fromobj)); index++) createcopy(label(fromobj, index), labels(toobj), 1); This code assumes that you will be able to define the object you want to copy labels from and the object that you want to copy the labels to. The third parameter in the createcopy command will make sure that the new node has the same name as the one it was copied from. Good Luck, Brandon
__________________
thats not normal. Last edited by Brandon Peterson; 06-04-2008 at 08:32 AM. |
The Following User Says Thank You to Brandon Peterson For This Useful Post: | ||
Brenton King (06-11-2008) |
#3
|
||||
|
||||
Sung,
If the labels on the items have to be exactly the same as the one from the container, you can also copy the label node with all it's content; treenode fromobj = (YOU DEFINE); treenode toobj = (YOU DEFINE); createcopy( labels(fromobj), labels(toobj), 1, 0, 0, 1); Where labels is an attribute that points directly to the label node of an object. Steven |
The Following 2 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
Sung Kim (06-04-2008) |
#4
|
|||
|
|||
Thank you
Hello, Brandon. Thank you for a quick response!
Your code works wonderfully on my model. I added one outer for loop to take care of multiple flowitems on a pallet. It works well too. Thank you also, Steven, for your suggestion! Sung |