question

Pinakin K avatar image
0 Likes"
Pinakin K asked Pinakin K commented

How to increment label values and use the new value in as a string?

labeltest.fsm

In the given model, I have referenced a 3d object as a value for the label, in order to use subflow.(Subflow not shown in the model)

I want to increment the value by one each time the token passes the Assign label activity, in such a way that, the object name would reflect in the label value.

Ex. current label name is LabelName and the value is Shape 24. I have 3 Objects in it, Shape 24, Shape 25, Shape 26. So every time the token passes the assign label activity the name should increment by 1, i.e. It should get the value Shape 25.

FlexSim 18.0.2
label assignmentincrement label
labeltest.fsm (19.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

·
Steven Hamoen avatar image
1 Like"
Steven Hamoen answered Pinakin K commented

@Pinakin K This is not directly possible because if you increase references to 3D objects you are actually referencing memory addresses and you never know where the next one is pointing to. But there is a very easy solution. Put your Shapes in a group and increase a counter and get the correct shape out with

Group("group")[memberindex]
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

Using a group is probably the easiest way of doing this.

You could also use model().find() which lets you find an object in the model by its name/path. For example, this returns a reference to Shape24

model().find("Shape24")

You could have a separate ShapeNumber label that you increment and then use that number to build the name of the shape you're looking for:

model().find("Shape" + string.fromNum(token.ShapeNumber))
1 Like 1 ·
Pinakin K avatar image Pinakin K Matthew Gillespie ♦♦ commented ·

Oh yes. thank you! But i was able to solve it using Group. I will also try the other method.

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.