Shade-Highlight selected meshes by C#

Hi all,

I am trying to check the Shade-highlight selected meshes in the Rendered view in C#:
image

I thought I found it, but it does not change anything:

        var displayMode = Rhino.Display.DisplayModeDescription.FindByName("Rendered");
        if (displayMode != null)
        {
            displayMode.DisplayAttributes.MeshSpecificAttributes.HighlightMeshes = true;
        }

Am I trying to change the wrong setting? Or is this a bug?

Thank you for your time.

  • Jordy

Try this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var renderedId = DisplayModeDescription.RenderedId;
  var displayMode = DisplayModeDescription.GetDisplayMode(renderedId);
  if (null == renderedId)
    return Result.Failure;

  displayMode.DisplayAttributes.MeshSpecificAttributes.HighlightMeshes = true;
  DisplayModeDescription.UpdateDisplayMode(displayMode);
  doc.Views.Redraw();

  return Result.Success;
}

-- Dale

Works like a charm. Thanks Dale.