6 Replies Latest reply on Mar 26, 2018 7:32 AM by Gertjan Van Dijk

    Addin applies the wrong color

    Gertjan Van Dijk

      Hello all,

       

      I am experiencing an issue where face colors applied trough a company custom add-in do not display as intended.

      This was first encountered in an add-in that took assembly-wise screenshots with a subassembly colored for reference; it did not cause problems there, as the exact color was not relevant.

       

      However; it has now also surfaced in our holes, here it is relevant, as we use these colors to quickly identify mismatches on the 3D-check.

      the attached image displays the effect: the top row is the color as is desired, the bottom row contains the exact same hole as it is added.

       

      equal colors.png

      This is especially a problem with the middle set (the yellow/brown one), as the yellow color is also used for a similar hole, slightly smaller.

       

      When i right-click the face, it shows the correct color; and it is indeed this color that is entered into solidworks by the API (i checked; the correct RGB is passed)

      This Color.png

      If i open the appearance editor in this way; the correct color is shown and previewed, but if i cancel out of the menu, the 'wrong' one is reapplied.

      RGB value.png

       

       

      We apply this color by first calling IFeature::GetMaterialPropertyValues, and then changing the RGB and emission values, before reapplying them with IFace::SetMaterialPropertyValues2, in all configurations.

       

      This method worked just fine in solidworks 2013, but it is now giving problems after we upgraded to solidworks 2017.

       

      of course, a workaround could be to change the colors used to not be so close together, but that would mean changing out the entire workflow of the design and production departments, this is highly undesirable.

       

      If a change in code could fix, or circumvent, this issue, i would be much obliged.