question

Robert Hambright avatar image
0 Likes"
Robert Hambright asked Robert Hambright commented

How do I transfer a label from a 3D item to a process flow token?

Hello,

I have a model that creates items with a label called "pflow". When these items exit the first coneveyor, a process flow token is created. How do I transfer this "pflow" label from the 3D item to the corresponding process flow token?

labels-3d-to-pflow.fsm

Thanks!

FlexSim 16.2.0
process flowlabels
5 |100000

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

Matt Long avatar image
1 Like"
Matt Long answered Robert Hambright commented

First you should ask yourself if you NEED to transfer the label. Oftentimes it is better to keep data in one place and reference that data rather than to make copies all over the place.

Regardless of what you decide, the first thing you need is a reference from the token to the item with the data. This can be done on the Event-Triggered Source.

By entering text into the Label Name column of the Label Assignment table, a reference to the Exiting Item will be created on the token that is created.

Once you have this reference, you can reference the item using the following code:

getlabel(token, "item")

Or in a Universal Edit you can type:

Label: item

To get a label off of the item, you can nest two getlabel() commands:

getlabel(getlabel(token, "item"), "pflow"))

Now if you do need to copy the label, your Assign Labels activity would look like this:

If you aren't sure exactly how to reference a label on your token, you can click the eye dropper (sampler) to the left of the Value property and click on the token to get a menu of available options:


itemref.png (13.9 KiB)
pflow.png (12.1 KiB)
sample.png (14.4 KiB)
· 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.

Matt Long avatar image Matt Long commented ·

In FlexSim 2017, dot syntax makes this even simpler by changing the code:

getlabel(getlabel(token, "item"), "pflow"))

to

token.item.pflow
0 Likes 0 ·
Robert Hambright avatar image Robert Hambright commented ·

Thank you!

0 Likes 0 ·
Regan Blackett avatar image
1 Like"
Regan Blackett answered Robert Hambright commented

@Robert Hambright

You are on the right track in your example model, you need to nest a call getlabel() to first get a reference to the flowitem that is entering the rack and then call getlabel() on that to get the value you are looking for. It sounds more convoluted that it is, here are the steps and an attached example:

First on your Event Triggered source you need to capture a reference to the exiting item using the Label Assignment table:

The Label Name is something you can choose, so whatever you type into that cell becomes a label on the token that points to the flowitem.

Next on your Assign Label activity, the value you want to assign is actually a Label value from the item. Since getlabel needs to know what object has the label you want to get, you need a getlabel(token, "item") expression which becomes the first parameter to the getlabel() function that gets the "pflow" label value:

3952-labels-3d-to-pflow.fsm


· 1
5 |100000

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

Robert Hambright avatar image Robert Hambright commented ·

Thank you!

0 Likes 0 ·

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.