Hey guys,
i try to change the color of a component (part) in a assembly via C# Addin. Iam already able to change the color of a part, but then all same parts change there color too. In my case, i want to be able to colorise all parts differently. Usally you can click on a part and change the color individually even when they are the same.
This is how i change the color of a part.
private void changeColor(ModelDoc2 model, string color)
{
Color rgb = Color.FromName(color);
double[] properties = {rgb.R / 256, rgb.G / 256, rgb.B / 256, 0.5, 0.5, 0, 0, 0, 0 };
model.MaterialPropertyValues = properties;
}
What i want to do is to change the color of an "AssemblyDoc.component" in a assembly.
This is how i get all components of the assemblydoc:
object[] comps = swAssemblyDoc.GetComponents(true);
Thx in advance!
Simon
SolidworksApi macros