Paritosh Singh

How to set color in sub parts

Discussion created by Paritosh Singh on Nov 19, 2019

Hello, I am working on a solidworks api to set color of parts. Issue is, I am able to set color to single parts but unable to set color if a part contains sub part (like a hierarchy).


I am working on C++/CLI, below is the code snippet.


IComponent2^ Partname =  (IComponent2^)swAssembly->GetComponentByName(partNameCLI);

array<double>^ colorValues =  (array<double>^)(Partname ->GetModelMaterialPropertyValues(Partname ->ReferencedConfiguration));

colorValues [0] = 1;

colorValues [1] = 0;

colorValues [2] = 0;

Partname ->MaterialPropertyValues = colorValues;


P.S. I am unable to set color to sub parts