Copy Paste Layer Color

Hello Everyone,

Just looking for a small thing! Does anyone know how just to copy paste same color from one layer tag to another?
It seems a rookie feature but when you have a file of 30+ layers and you want to Highlight it in view by color it’s painfull to go through everylayer and change one by one! Does anyone know if it is even possible to make it? Dragin and droping a from one color to another doesn’t work and right clicking in it also doesn’t work either!

Maybe we can have it in a next installment?

Best to you all!

This sounds like a problem only an Extension Developer(Hero) can solve with the power of Ruby API!!!

Let me see…
The idea is to apply the new color to layers which are visible so to ignore the ones you don’t want to affect just shift or control-click them in Layer panel & disable them. Then once the plugin do its work make them visible again. NOT the prettiest of solutions but something is something!


#Get Layers...
model = Sketchup.active_model
layers = model.layers

#Iterate all layers...
layers.each do | layer |

  #Will apply the new color to visible layers only...
  if layer.visible?
    layer.color = Sketchup::Color.new(192, 0, 0) #Change (R,G,B) values
  end #if

end #do

Above is a rough idea of how to solve your problem, but it needs some kind of user input for the color. Maybe I can build a simple ‘plugin.rb’ or maybe another developer can do it as well.

Also, you can download a Ruby editor in the Extension Warehouse and copy-paste my code to make it work.

Cheers!

2 Likes

Hi RafaelRivera!

Thanks! It just worked great! Thanks a lot! Like you’ve said not the prettiest solution, and we still need to know the rgb, nevertheless it helps a lot!

Nevertheless my idea was somehow to have something more userfriendly and just draging a swatch of color from one layer to the other! Probably is a bit hard to code, but would be a great asset to have on the software though. I just use the color on layers a lot to make things clearer in the model and that would be a great feature to have!

1 Like

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