Creating a custom viewport display mode button

Hi, this is probably one of those real easy things that I’m just not getting… I’ve created a custom display mode which is Shaded with the lines turned off, called it ShadedNoLines. Now I’m trying to have it as a button option on my Popup Menu, but when I enter the command text that I think it should be it does work.

The text I’ve entered in to the command window of the button editor is ! _ShadedNoLinesViewport but it just says Unknown command. I have it in the macro list of the Workspace editor and have tried numerous versions of the command but no luck.

I’ve created buttons before but this one is perplexing me! Any help?

Thanks,
J

you have to use !_SetDisplayMode Mode=ShadedNoLines

Superb, thanks!
I’d tried !_SetDisplayMopde Mode_ShadedNoLines but that only brought up the option to change the display mode.

Haha, knew it would be something simple!

Thanks :slight_smile:

Hi,
I have a similar problem:

I created a custom rendered shadening display mode named: MY-RENDER-ON-BLACK

so as suggested I creatd a button where left click has:
!_SetDisplayMode Mode=“MY-RENDER-ON-BLACK”

right mouse button click has:
!_SetDisplayMode _Viewport=_All _Mode=“MY-RENDER-ON-BLACK”

sadly this only works partially…
If I set this manually inside a viewport dropdown it works.
after that also the right mpuse button applies my shading setting on all views.
however left does not work.

Instead I’m asked to set a display mode manually…

What am I missing?

'_-SetDisplayMode Mode="MY-RENDER-ON-BLACK"

Replace the ! with a ' and use a dash in front of _SetDisplayMode

Edit - Hmm, guess the dash is not needed - don’t know why mine have them - must have modified them at some point.

Just a slight tune up, @JSD - if you are using display mode changes as you work, you probably do not want the ! at the start of the macro - this will stop any running command. Instead you can put the ’ prefix, with no space, to tell Rhino that the following command is nested (i.e. can be run inside another command)

'_SetDisplayMode Mode=ShadedNoLines

If you do want the ! then put a space after it and before the actual command name including the “_” part.

! _SetDisplayMode Mode=ShadedNoLines

-Pascal

1 Like

Great tip, thanks Pascal, just tried it and works great.

Thanks for the quick reply!
I tried but still not working…
not sure where the ! came from… (I thought it was a override for language settings…)

anyways, I tried:
'_SetDisplayMode _Viewport=_MY-RENDER-ON-BLACK
replicating the standard Shaded view button which I cloned

and also:
'_-SetDisplayMode Mode=“MY-RENDER-ON-BLACK” as you suggested, but I always end up whith Rhino asking me WHICH shading mode I want…

How can I tell Rhino to go on by itself and shose my custom shading setting?
I guess it’s a nested command, right?

I add some screenshots that may help.

SHDERS
BUTTONS




Try
'_-SetDisplayMode Mode=MY-RENDER-ON-BLACK

It does seem a little weird how this works with display modes and quotes.

-Pascal

also here… not sure where the quotes came from :sweat_smile:
but it doesn’t matter… no change… :-\

Rhino still stops and asks which shading mode I want to use.

I wonder if i CAN change to any shading mode that is not a standard one…

or maybe I need to remove all the dashes form the name?

I tried … and yes… it was that!!!

I changed the shaded view name to just: RenderedBlack (no dashes or underscores)
'_-SetDisplayMode Mode=RenderedBlack

now it works like a charm!!! also setting all 4 viewports in one shot!
:partying_face:

thanks for your help!!!

Wow, that is weird. I have a mode name that has a space in it - “Shaded Light” and I made a button for it.

The macro is

'_SetDisplayMode _Viewport=_All "Shaded Light"

If I click the button, only the active viewport is set to Shaded Light. If I click it again, all the others are…

Even weirder - here’s what the command history reports:

Command: '_SetDisplayMode
Select a display mode ( Viewport=Active Mode=ShadedLight ): _Viewport=_All
Select a display mode ( Viewport=All Mode=ShadedLight ): “Shaded Light”
Display mode set to “ShadedLight”.
Command: _CommandHistory

Look at the next-to-last line - it has removed the space from the name…

1 Like

Right, this has always been the case, I think , I can’t remember right now why Jeff did it this way…

-Pascal

OK, didn’t know that, or maybe I just forgot. Will now stick to the convention of Display mode names having no spaces or special characters…

Maybe the Help topic should mention this?

And yes, as mentioned in another post, maybe the Wiki page needs to be updated and have more complete info…

After testing here it looks like no special characters are recognized, the display mode name should not contain dashes, underscores, spaces, slashes etc. if you want the macro to work. Funny because if you duplicate a display mode it initially is proposed as Copy of XXX with two spaces in it. Now revising all of my custom display mode names to be one single camel-cased name with no spaces, dashes or underscores.

2 posts were split to a new topic: Export macro fails