How do you toggle Color by Tag for both Windows and Mac

I would like to create a button that toggles Color by Tag. The API docs lists Sketchup.send_action(10545), but it seems despite being wrong (it toggles the shadows) it’s for PC only. Is there a way of doing this?

Found it…

model.rendering_options["DisplayColorByLayer"]

Yes, but … it works permanently for the model level and any scene pages that are not using their own rendering options. It can temporarily change the style for scene pages that use their own rendering options, but a switch to another page and back will reset that page. (So in a sense it is sort of a safe switch if the user has scene pages that use their own styles.)

The purpose if the button is to be a faster version of the toggle option inside of the layers panel. So the native UI-behavior is exactly what we want. By your description it seems that it works that way.

Avoid Sketchup.send_action whenever possible.

1 Like