Change the color of several layers at once

Set color for Tags of selection.

Copy-Paste the code below to Ruby Console and hit Enter (Return).

Select the imported geometries.

Type into Ruby console e.g.:
Dezmo::ColorSelectionTags::set_color(128,128,128)

Where the 128, 128, 128 is an integer (0-255) representing the RGB colors.

The Tags assigned to the selected Drawingelements (including nested) will get a color what you give as R G B parameter.

Use at your own risk! Does not really tested by me! You can undo it…

module Dezmo
module ColorSelectionTags
  extend self
  
  def instance?(obj)
    obj.is_a?(Sketchup::Group) || obj.is_a?(Sketchup::ComponentInstance)
  end

  def get_selected_layers(ents, selected_layers = [])
    ents.each{|ent| 
      selected_layers<<ent.layer if !selected_layers.include?(ent.layer)
      return selected_layers if selected_layers.size == @layers_size
      if instance?(ent)
        get_selected_layers(ent.definition.entities, selected_layers)
      end
    }
    selected_layers
  end

  def set_color(r, g, b)
    model = Sketchup.active_model
    seldwge = model.selection.grep(Sketchup::Drawingelement)
    return unless seldwge.first
    layers = model.layers
    @layers_size = layers.size
    selected_layers = get_selected_layers(seldwge)
    
    model.start_operation("Set color for Tags of selection", true)
    selected_layers.each do |layer|
      layer.color = [r,g,b]
    end
    model.commit_operation
  end
  
end
end