Hover / Highlight entities


#1

Is there a option to highlight specific entities in a color?


#3

I’m trying to build a treeview of the entities in my model and would like to distinguish the entities I just selected. I thought about temporarily assigning a material and restore the old one as soon as the “selection” is finished, but this seems way to complicated for a usually simple job.


#4

You could use a temporary layer with a distinct color assigned and switch into ‘color by layer’ on selection…

although, the view.draw methods are the de-facto way of highlighting selections when inside a Tool…

john


#5

You could activate your own custom Ruby Tool and draw your highlights using view.draw calls.

That’s what I do with Solid Inspector: https://extensions.sketchup.com/en/content/solid-inspector²

It avoids the overhead of modifying entities - as well as making sure you don’t clutter the undo-stack.


#6

Will the view be reset after I paint on it, or do I net to do that manually?


#7

The view will be reset a number of times, and you need to make sure you redraw in the Tool.draw(view) method. To manually trigger the view to draw - such that draw is executed - you’d call view.invalidate within the tool.

By the way, you can inspect the source for Solid Inspector on BitBucket: https://bitbucket.org/thomthom/solid-inspector