Is it possible to get the user-defined colors and materials in Grasshopper’s preview settings?
Normally, these are passed on the the preview methods of parameters, but I have a more complicated system where I would like to be able to query these colors regardless of what is passed to the preview method.
To get/set colors, you could use this
var doc = OnPingDocument();
var previewColour = doc.PreviewColour;
var previewColourSelected = doc.PreviewColourSelected;
I don’t quite know in which context you need this. But you could also in case of a component do something like this:
private Brep brep;
public override void DrawViewportWires(IGH_PreviewArgs args)
{
base.DrawViewportWires(args);
var someCustomMaterial = new DisplayMaterial(customColor);
args.Display.DrawBrepShaded(brep, someCustomMaterial );
}
Don’t know if that is what you’re looking for, but if so I can give you a bit more in dept example.
1 Like
That’s great, exactly what I was looking for.
Thanks!