Change the color of some selected components


#1

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


#2
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.


#3

That’s so cool! thanks so much


#4

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