question

James Rodgers1 avatar image
0 Likes"
James Rodgers1 asked Felix Möhlmann answered

Restore color to objects on a dynamic route

I would like to "illuminate" the route in a dynamic routing model, then when the route is no longer being used, return the objects back to their original color. In the attached model I try to do that by saving the objects in an array, saving the rgb components of those objects, changing all objects to orange, delay, then restore the original colors. When I do this, all objects are colored black. When I use the same approach in a script window using the saved rgb values, the objects are not black but they are also not the original color. What am I doing wrong? Color RGB Example_6.fsm

FlexSim 23.0.3
colorrgb
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

In the code that restores the colors you forgot to use the index "i" for the RGB values. Currently you pass in the entire arrays of values for each color component, which gets interpreted as a 0 and results in the color becoming black.

You also swapped the green and blue components when you store the original colors (green gets assigned to SaveB and blue to SaveG. The values in the script console also have these components swapped, so you get the wrong colors, except in the cases where those components have the same value.

1678483339468.png


1678483339468.png (3.2 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.