Calculating color values ​​in the design table

By inserting an Excel configuration table, the color column is generated by default. As you know, the standard color of models in SOLIDWORKS is gray.

However, we do not use colors in the table, like: red, black or blue. The table uses a numerical term.

Color parameter in configurations

So how can you determine the selected color from the table??

There is a special pattern for this purpose. But before I write about it, Below I present the basic colors expressed numerically.

Color parameter in configurations

Calculating color values ​​from a formula.

 

You can calculate a 32-bit integer color value in the configuration table, using values ​​for components: red, green and blue of a given color.
To apply a different color for each configuration, you need to associate display states with configurations.

 

To calculate the color value in the design table, should:

In the configuration table, enter $USER_NOTES in cells B2, C2 and D2 and enter $COLOR in cell E2.
You may need to insert columns like this, so that these parameters appear in cells B2 to E2.

In B3 cells, C3 and D3, enter the color components: red, green and blue. Values ​​must be stored as numbers and not text.
Then enter the following formula in cell E3:

= MAX(MIN(B3,255),0) + MAX(MIN(C3,255),0)*16*16 + MAX(MIN(D3,255),0)*16*16*16*16

Please make sure, that there are no extra spaces before the = sign in the cell.

This pattern provides, that each of the component values ​​is in the range from zero to 255.

 

Leave a Reply

Your email address will not be published.