IgnoreHighlight

Hey all,

I’m trying to program a command to switch off all object highlighting. At the moment I’ve two possible solutions, both not working as intended.

{
            Guid displayModeGuid = 
            RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.DisplayMode.Id;
            Rhino.Display.DisplayModeDescription displayModeDescription = 
            Rhino.Display.DisplayModeDescription.GetDisplayMode(displayModeGuid);
            displayModeDescription.DisplayAttributes.IgnoreHighlights = true;
            RhinoDoc.ActiveDoc.Views.ActiveView.Redraw();
            return Result.Success;
 }

While debugging I can see that the setting is being changed. But in the display nothing is changing.

2:

{
            foreach(RhinoObject rhinoObject in RhinoDoc.ActiveDoc.Objects)
            {
                rhinoObject.Highlight(false);
            }
            return Result.Success;
}

Using this option toggles the highlights, but as soon as I reselect something. Highlights are switched on again.

Any ideas on how to make either or another option work?

regards Reinder

Hi @r.weenink,

Can you explain what you are really trying to do and why?

Thanks,

– Dale

Hi Dale,

Thanks for asking.

In the company we model (shoe)lasts. While modelling we place the last above a rendered picture of a 2d footscan. Because we work with meshes selecting the mesh will highlight the complete wireframe of the mesh. This wireframe is quite dense, which in effect hides the rendered 2dfootscan.
Therefore we want to make commands for switching the highlights off and on.

If not clear pleas ask.

regards Reinder

Hi @r.weenink,

See if this Python script works for you:

import Rhino
import scriptcontext

def test_toggle_highlight():
    id = Rhino.Display.DisplayModeDescription.WireframeId
    desc = Rhino.Display.DisplayModeDescription.GetDisplayMode(id)
    desc.DisplayAttributes.IgnoreHighlights = not desc.DisplayAttributes.IgnoreHighlights
    Rhino.Display.DisplayModeDescription.UpdateDisplayMode(desc)
    scriptcontext.doc.Views.Redraw()
    
if __name__ == "__main__":
    test_toggle_highlight()

– Dale

Hi Dale,

Thanks. Your example showed me that I forgot to update the Displaymode.

regards Reinder

{            
            Guid displayModeGuid = 
            RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.DisplayMode.Id;
            Rhino.Display.DisplayModeDescription displayModeDescription = 
            Rhino.Display.DisplayModeDescription.GetDisplayMode(displayModeGuid);
            bool isOn = displayModeDescription.DisplayAttributes.IgnoreHighlights;
            if(isOn == true)
            {
                displayModeDescription.DisplayAttributes.IgnoreHighlights = false;
            }
            if (isOn == false)
            {
                displayModeDescription.DisplayAttributes.IgnoreHighlights = true;
            }
            Rhino.Display.DisplayModeDescription.UpdateDisplayMode(displayModeDescription);
            RhinoDoc.ActiveDoc.Views.ActiveView.Redraw();
            return Result.Success;
}