• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Turn off all layers except selected?

Scheduled Pinned Locked Moved Newbie Forum
sketchup
3 Posts 3 Posters 1.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    johnjohn78
    last edited by 17 Dec 2018, 11:46

    Hi All,

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

    Thanks in advance

    John

    1 Reply Last reply Reply Quote 0
    • S Offline
      sdmitch
      last edited by 17 Dec 2018, 16:03

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

      
      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
      
      

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 17 Dec 2018, 17:36

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

        TIG

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          2/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement