Turn off all layers except selected?

The ideal place for beginners to get help using SketchUp

Turn off all layers except selected?

Postby johnjohn78 » Mon Dec 17, 2018 12:46 pm

Hi All,

Is there a plugin or method to turn off all layers except the geometry that is already selected?

Thanks in advance

John
0

johnjohn78 
 

Re: Turn off all layers except selected?

Postby sdmitch » Mon Dec 17, 2018 5:03 pm

Make selection, paste following code into Ruby Console, press Enter.

Code: Select all
mod = Sketchup.active_model
sel = mod.selection
unless sel.empty?
  layers = []
  sel.to_a.each{|e|
    layers << e.layer
  }
  layers.flatten!;layers.uniq!
  mod.layers.each{|l|
    next if layers.include?(l)
    l.visible=false
  }
end
0
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch 
PluginStore Author
PluginStore Author
 

Re: Turn off all layers except selected?

Postby TIG » Mon Dec 17, 2018 6:36 pm

You might also to want to trap to avoid trying to switch off the 'current layer' [which is usually, but not exclusively, Layer0], otherwise that could throw an error...
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Newbie Forum

Who is online

Users browsing this forum: Bing [Bot], weider382 and 2 guests

Visit our sponsors: