question

chao.g avatar image
0 Likes"
chao.g asked Jeff Nordgren answered

How to set color for all created objects in process flow based on item type

This should be a fairly simple thing to do in FlexSim process flow.

In the attached model, I am trying to set item color after the create object activity " Queue1 Fill", "Queue2 Fill", "RO Fullfill" to all the items I created based on the label "PartType" out of 3 labels created "Line", "Station", "PartType", how could I do this in process flow?

Thanks,test.fsm

FlexSim 16.2.0
process flow create object
test.fsm (22.8 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.

Jeff Nordgren avatar image
1 Like"
Jeff Nordgren answered

@chao.gao

Attached is your model with the changes that I've made. I added a Run Sub Flow processing block after each Queue Fill and a Change Color custom code block in the Sub Flow.

The sub flow cycles through all of the flowitems in the queue and assigns them a color based on the PartType label of each flowitem. I changed the PartType in the Queue2 Fill to 2 so that you could see that it works, rather than have both of them be 1.

Let me know if this solution will work for you.

test-jn1.fsm


test-jn1.fsm (24.4 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.

Adrian Haws avatar image
0 Likes"
Adrian Haws answered chao.g commented

Hi Chao,

Yes, this is simple to do in Process Flow. Normally the best way to do this is to create a "Change Visual" activity and select "Set Object Color". There are two fields, called "Object" and "Color". In the first, the default is to get the "item" label from the token. In the second, you can choose Color Array, then pass in something like this:

colorarray(object, getlabel(token, "itemType"))

If the values for "itemType" are integers, then each label value will result in a different color.

However, in your model specifically I would go about it a slightly different way. Your Process Flow is creating an array of 50 boxes on the "item" label, then overwriting that label to create 50 more in a different queue. To change the color in Process Flow you would have to find a way to reference each box individually and look at its label value. A much simpler way to do this would be to just set a trigger for the "OnEntry" of each queue to set the object color based on a label value.

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

chao.g avatar image chao.g commented ·

Adrian:

Thanks for the response, I prefer to do this in process flow where I can easily scale up to many other objects. How would I be able to reference each individual box in the array item, i tried to use a for loop, then within that, colorarray(getlabel(token,"item[i]),"PartType”), this doesn't work though.

Thanks,

0 Likes 0 ·