Possible to display a component in another colour without setting global style?

I would like to show particular related components in a different colour. Is there a way to do this through ruby without setting the global style? This will most likely be done in the tool’s draw function.

You can show objects in their tag (layer) color, but yes you have to temporarily change the style to “Color By Tag”. (Or temporarily add a scene page with it’s own style, and change that. Then when the tool ends, switch back to the previous scene page, and delete the temporary page and it’s style.)

Otherwise you would have to trace over the top of a component’s edges with view.draw calls. This might be slow.

You could just draw the component’s bounding box in a highlight color. That might be faster.

Usually when we make style changes, we save the current settings and restore them after whatever we needed to do.

Ex:

model = Sketchup.active_model
opts = model.rendering_options
cbl = opts["DisplayColorByLayer"]
opts["DisplayColorByLayer"]= true
# do whatever
opts["DisplayColorByLayer"]= cbl

Ok. Thanks. I’ll think about the design.