Set transparency of ghosted view via macro/python

Hi all,

I was wondering if it was possible to change the transparency of the ghosted view via script/macro. The way you can do through rhino is using the menu DocumentProperties / view / display mode / ghosted / transparency. Do you reckon there is any way to do it while working on a python script with a rhino command?

Thanks in advance

Vincenzo

with python it is

import rhinoscriptsyntax as rs

views = rs.ViewNames()
for view in views:
    rs.ViewDisplayMode(view, 'Shaded')

or to change current viewport

views = rs.ViewNames()
for view in views:
    rs.ViewDisplayMode('Top', 'Pen copy')

I believe this would be the macro, though I don’t use them much …

'_SetDisplayMode _Ghosted

Hi rhinorudy, maybe my answer wasn’t clear enough. I don’t just want to change the view from shaded to ghosted but I want to alter the Ghosted view’svalue “Transparency” which can be found normally in DocumentProperties / view / display mode / ghosted / transparency and wondering if could be altered via a rhino.common command or a macro
Thanks
V.

Good question, possibly with Rhino common via python,

I have a different ghosted transparency setting saved as Ghosted copy could be renamed Ghosted 70% maybe.

Then call that ViewDisplayMode.

Just a thought, good luck.

Doesn’t look like this is easily do-able, not all the display mode parameters are exposed in RhinoCommon. A possible hack may be to change the object color setting - one of those settings which is exposed - to something that has a lower alpha channel value. But I’m not sure that will cover all situations.

Edit: actually, that doesn’t work, I can change the object color alpha value, but it doesn’t affect the display. So, in the end, I don’t see any controls on Ghosted transparency exposed to scripting.

Macro-wise, the only current possibility is to have set up a copy of the display mode as Randy suggested and switch to that with a macro.

If you don’t need to change things while a script is running, then the best bet is probably just via the Display panel.

Edit#2 One other thing that might be possible is to set the object(s) in rendered mode via SetObjectDisplayMode), then change the transparency of the render material…

HTH, --Mitch

Hi @revink

Currently it can be done via RhinoScript - looks like in RhinoPyhton the needed RhinoscriptSyntax methods were not yet implemented (ImportViewDisplayMode / ExportViewDisplayMode). Anyway - see attached for how it can be achieved.

hth,

Jarek

RS-ChangeGhostedTransparency.rvb (2.0 KB)

https://mcneel.myjetbrains.com/youtrack/issue/RH-41283