Change the color of some selected components

Hi All,
I am pretty new to Ruby.
I have thousands of the same components in one file and I am thinking of a way to count a bunch of the selected components and change their colors. How can I do it with Ruby console in sketchUp?
Thanks so much

m=Sketchup.active_model;s=m.selection;s.grep(Sketchup::ComponentInstance).each{|ci|ci.material='red'}

Copy and paste this one-liner into the Ruby Console. Change the color as needed. FYI, component instance material is only applied to faces that have the default material.

2 Likes

That’s so cool! thanks so much

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.