question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Axel Kohonen answered

Is it possible to set token colors in Process flow visualisation using values in a table?

Hi,

I have a model where I have different itemtypes drawn in different colors or actually the objects change to the color of the itemtype of the item that is within them. I have a process flow that controls the model and sets the colors of objects based on a color table. See the attached simplified example model colortest.fsm.

To be able to better track how the tokens correspond to the 3D model I would like the tokens to use the same colors as are defined in the colors table. Thus I would see which token corresponds to what objects in the 3D model. In the test model this is easy as there are only 3 colors so I can set them manually to be the same colors.

Is there some way of setting the colors of the tokens so that I could use it in my real model that has around 60 different colors? Alternatively if someone can tell me where I can find the colors used by FlexSim (the FlexSim color palette) then I can probably use the same colors in the color table. This would reverse the problem, but be a solution also.

The colors I want to access are the ones defined with "Define legend" as seen in the image below. I tried to dig in the model tree to find where the colors are defined but I could not find them. Anyone that has a clue where they are in the tree? If I find them I guess I can change them and add more as required.

Thank you!

Kind regards,

Axel

FlexSim 16.2.1
process flowtokencolor
idsbe.png (42.6 KiB)
colortest.fsm (21.7 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.

Axel Kohonen avatar image
2 Likes"
Axel Kohonen answered Sam Stubbs rolled back

Hi,

Now I found the settokencolor function which obviously solves the problem partially as I can set the color of the token to whatever color I desire. Just remove the color setting using itemtype from the process flow visualisation. The problem with this approach is that the colors of the child tokens have to be set separately as they will otherwise be the default color. Not sure how to solve this.

The sort of working model:

colortest-works.fsm

Axel


colortest-works.fsm (22.0 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.

Axel Kohonen avatar image
0 Likes"
Axel Kohonen answered

Another option that I pointed to in the question is to use the colorarray function in FlexSim to get the colors that FlexSim uses and then enter these into the color array that the flowitems use and set a color label on the tokens that corresponds to this. This way we get the tokens and the flowitems to be the same color for easier debugging.

This is maybe not as flexible as one has to use the colors defined in FlexSim, but it works. A script to get the RGB color values to the output console is below.

Axel

//create a queue
treenode queue = createinstance(node("MAIN:/project/library/fixedresources/Queue", model()), model());

clearconsole(); //clear the output console

//how many colors do we need?
int amountOfColors = 66;

for(int i = 1; i <= amountOfColors; i++){
    //set color to queue
    colorarray(queue, i);
    //get the colors from the queue
    double colorR = getcolorcomponent(queue,1);
    double colorG = getcolorcomponent(queue,2);
    double colorB = getcolorcomponent(queue,3);
    //print colors in the output console
    pf(colorR);pt(",");
    pf(colorG);pt(",");
    pf(colorB);
    pr();
}

//delete the queue
destroyobject(queue);
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

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.