question

mary avatar image
0 Likes"
mary asked Felix Möhlmann commented

Assigning label to flowitem

Hello, I have model where I am assigning label to flowitem Box as Part_num and Loc(location) where it should read Part_Num as part names and location where it is located how can I assign that with code. Simple model attached.

Assign_label_to_flowitem.fsm

FlexSim 20.0.10
flowitemlocation
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 Felix Möhlmann commented

The 'Part_num' label can be assigned in the 'On Creation' trigger of the source.

1658218388717.png

For the location label, you can use the 'On Entering' trigger of the flow item itself to update the label each time the item enters into an object. (I guess you could also assign the 'Part_num' label there, if the item directly enters an object after being created.)

1658218432088.png


Alternatively, you could also set both labels up as FlexScript labels that get evaluated each time their value is accessed. So 'item.Loc' for instance would return the current container object. However, the value would not appear in the labels table of the item. (See the cylinder flow item in the attached model)

assign-label-to-flowitem-fm.fsm


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

mary avatar image mary commented ·
Thank you @Felix Möhlmann . What if i am using pallet part how will i assign location to that.
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann mary commented ·

Do you mean assign the location to the item on a pallet or to the pallet itself?

For the first, you either keep the current logic, which will then display the pallet as well as its container object in the label.

1658298296670.pngTo only get the object the pallet is currently in on the items on it, you will have to use the second option of using FlexScript labels and modify them to go up one level further if the container object is a pallet.

1658299031081.png

(If the pallets have a different name you have to adjust the condition to fit your model)


You can use the same logic the boxes uses to assign the location to the pallet directly. I didn't actually know that the triggers were missing from the GUI of container flow items in the 2020 version. The event still works though. You have to manually insert the repsective node into the 'eventfunctions' subnode of the pallet. Right-click on the item in the flow item bin and open its tree (both the box (where the code is already present) and the pallet). Then navigate to the node and copy it over to the pallet's tree as shown below.

1658298806915.png

1658298793461.png

assign-label-to-flowitem-fm2.fsm

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.