question

Tom J avatar image
0 Likes"
Tom J asked Tom J commented

2 questions about changing the color of a box in 2 different spots

I have tried to look for an answer but cant find what i am looking for

1)I have a source that feeds a separator. The separator spilts the box by an expression of 2 and the flow is set to round robin to go to 2 different queues at the same time. So i have the separator making a left hand part and a right hand part from the same source. I would like to set the boxes to change color on exit. One blue(LH), one orange(RH). I cant get the onexit trigger to change to 2 different colors.

2)Later in my model. I have a queue that receive a pallet with a box on it from a combiner. I would like the change the color of the box on the skid to yellow. Hopping to do this with the onentry trigger. Any time i try this, it only changes the color of the pallet, not the box that is on it.

Thanks for any help on either point.

FlexSim 17.1.2
color change
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

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Tom J commented

To answer the first question, you can assign the color based on the port number. To do that, in the OnExit trigger, choose the Set Color By Case in the Visual menu. Then, change the Value field to say "port". Use the green plus button to add two new cases. The values 1 and 2 now represent which output port you're dealing with. It should look something like this:

For the second question, the issue is that the item that enters is the pallet. If there is only one item in the pallet, you can use something like this in the OnEntry trigger for the queue:

If there is more than one item in the pallet, you can use a custom code option, with the following code, which works for any number of items:

Object item = param(1);
Object current = ownerobject(c);
int port = param(2);

var itemList = item.subnodes;
for (int i = 1; i <= itemList.length; i++) {
	Object palletItem = itemList[i];
	palletItem.color = Color.red;
}

I have attached a model, with the first two examples working.

colordemo.fsm


objectcolor.png (5.5 KiB)
colorbycase.png (11.4 KiB)
colordemo.fsm (17.5 KiB)
· 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.

Tom J avatar image Tom J commented ·

Thank you @jordan.johnson Works like just how i wanted it to. I was trying close to both these options but never tried Port for #1 and I never knew about item.first for #2. Thanks for the help

0 Likes 0 ·