0 Replies Latest reply on Mar 28, 2018 4:32 AM by Hadyn Hadynlander

    ModelDocExtension.GetMaterial gives unexpected results and ModelDocExtension.GetRenderMaterials2 sometimes returns different color values for the same material (C# Standalone App)

    Hadyn Hadynlander

      I have a test assembly (A) in which calling GetMaterial(1, "") on the root returns a material with GetMaterialIds values (62, 0). The deprecated MaterialID value on the RenderMaterial is reported as 1, but that value changes when the same material is accessed through a different method, such as GetRenderMaterials2.

       

      In another test assembly (B), GetMaterial seems to return null no matter what input I give it.

       

      In both assemblies I am able to successfully iterate through the material collections with GetRenderMaterials2, and both do contain a valid material with ID values (1, 0) - which is what I was expecting to see returned from GetMaterial(1, "").

       

      The reason I'd been attempting to use GetMaterial was to debug another issue that's popped up. In assembly A the color on that material seems to change between two different values each time my application is run. The material always has the same IDs (1, 0) and the same list of entities it's applied to, but sometimes the RenderMaterial.PrimaryColor field is dark red, and sometimes blue. It always appears blue when viewed in the Solidworks Windows app.

       

      Has anyone else come across these behaviours, or have any thoughts on what might be going on here?

       

      Regards,
      Hadyn