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.

Hi Dale Fugier

Does this apply in RhinoCommon?

Well, the code above uses RhinoCommon. Or am I not understanding your question?

– Dale

import Rhino

renderedId = Rhino.Display.DisplayModeDescription.RenderedId
displayMode = Rhino.Display.DisplayModeDescription.GetDisplayMode(renderedId)
Rhino.Display.DisplayModeDescription.MeshSpecificAttributes.HighlightMeshes = true
Rhino.Display.DisplayModeDescription.UpdateDisplayMode(displayMode)

I´m using Rhino 5

Hi @cristiano.pasini,

Here is a link to the RhinoCommon API for V5. You might search it to see if those features, you’ve referenced, are available.

– Dale