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.