sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Looking for Plugin

    Scheduled Pinned Locked Moved Plugins
    9 Posts 6 Posters 429 Views 6 Watching
    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.
    • kenK Offline
      ken
      last edited by ken

      Question:

      Is there a plugin that will make scenes for each layer? So if I have 5 layer, run the plugin, the plugin will create 5 scenes with the name of the layer. Seems I have seen a plugin that did this, however, I can not find it, or I am using the wrong search text.

      Thank you in advance

      Ken

      Fight like your the third monkey on Noah's Ark gangway.

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Copy+Paste this code into a file called layer2scene.rb in the Plugins folder

        module TIG
          def self.layer2scene()
            model.start_operation('layer2scene')
            layers=[];model.layers.each{|layer|layers<<layer.name}
            layers.sort.each{|name|model.pages.add(name)}
          end
        end
        

        Restart Sketchup.
        Type TIG.layer2scene in the Ruby Console to make a set of Scene tabs named after every Layer name... Making new scene tabs is not 'undo-able'... so save first and use with care!

        EDIT: use the corrected code in the post three on - this one has a typo 😳

        TIG

        1 Reply Last reply Reply Quote 0
        • kenK Offline
          ken
          last edited by

          TIG

          Thank you for your quick reply. I added the line as indicated below as it did not work with the code you provided. So, I get two for the price of one. Some code that I will try to add to a toolbar and a learning exercise in Ruby. It is a good day when you have corrected TIG's code.

          module TIG
          def self.layer2scene()
          model=Sketchup.active_model # Added by Ken
          model.start_operation('layer2scene')
          layers=[];model.layers.each{|layer|layers<<layer.name}
          layers.sort.each{|name|model.pages.add(name)}
          end
          end

          Thanks

          Ken

          Fight like your the third monkey on Noah's Ark gangway.

          1 Reply Last reply Reply Quote 0
          • Rich O BrienR Offline
            Rich O Brien Moderator
            last edited by

            @unknownuser said:

            It is a good day when you have corrected TIG's code

            At times I wonder if he does this intentionally?

            Download the free D'oh Book for SketchUp πŸ“–

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              Of course I did !
              The correct code is

              module TIG
                def self.layer2scene()
                  model=Sketchup.active_model
                  layers=[];model.layers.each{|layer|layers<<layer.name}
                  layers.sort.each{|name|model.pages.add(name)}
                end
              end
              

              There is no point in adding a start/commit block as adding scenes is not undo-able! I edit the code at the last minute when I realized that BUT removed the wrong line... I was rushing because my dinner was ready πŸ˜’ even I have to eat πŸ€“
              Sorry for the balls-up - congrats on fixing it yourself... πŸ˜‰

              TIG

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                What?! You eat?!? 😲

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  I eat and drink... like mere mortals πŸ˜‰

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • pilouP Offline
                    pilou
                    last edited by

                    But you don't sleep πŸ˜‰

                    Frenchy Pilou
                    Is beautiful that please without concept!
                    My Little site :)

                    1 Reply Last reply Reply Quote 0
                    • 3 Offline
                      3dsmax9
                      last edited by

                      is it possible to hide the other layer excepte the one that hade the scene name? so you will have every layer in separate scene.

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

                      Advertisement