I have a question related to SetObjectDisplayMode. I am working on a C# script to set it for all views at once (Model and Layout) for selected objects.
I am aware that Rhino 8 has an option to set the view-related Display Mode for a single object in multiple views:
But that is not good enough for me, as one has to set the mode in each view manually, and a Detail view in a Layout appears in the list only when inside that same view.
What I am trying to do is a one-shot solution with a C# script. I have found that the SetDisplayModeOverride
method has an override that should set the object view mode for all viewports:
I’ve implemented it in the attached script, but it fails when I try to run the script. If you try the script (open it with the ScriptEditor and run it), after the objects selection and display mode selection, the script writes in the command line the result of the attempt to change the object display mode for each selected object (and it is invariably False). The script also has the option to choose the Display Mode via an Eto Dialog (for this, set the useEto variable to true).
Am I missing something in my script?
I’ve also seen this other script:
and it works, but it uses the view-based override of SetDisplayModeOverride
, cycling through all existing Model viewports, but not the Layouts.
I’ve also seen these other related threads, but none of them offer a solution to my question:
Since the all-view override of SetDisplayModeOverride
isn’t working, I cannot test whether the Display Mode set for an object persists even in new viewports (but I doubt it).
That would also be a desired option: set the Display Mode for a single object so that it is an attribute of the object regardless of the viewport. There was already a request for this here: SetObjectDisplayMode applies to only one viewport. Is that logical?
This resulted in a YouTrack that was subsequently closed as considered solved by the Rhino 8 option to set Display Mode for multiple views from the Object Properties panel: https://mcneel.myjetbrains.com/youtrack/issue/RH-59215
Of course that is an improvement of the previous situation, but hardly the same thing as what was requested; I still would like the option of an object Display Mode set in one shot for all views (present and newly created).
Sorry for the long post, I wanted to give an as much as possible comprehensive context; here’s the script I’m working on.
SetObjectDIsplayMode_allViews.cs (4.9 KB)