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

    Switch to scene by ruby script

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 4 Posters 868 Views 4 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.
    • N Offline
      N Lindenthal
      last edited by

      If I know the name of a scene, how can I switch to it by ruby script?

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        page = Sketchup.active_model.pages["Page Name"]
        Sketchup.active_model.pages.selected_page=page

        Hi

        1 Reply Last reply Reply Quote 0
        • N Offline
          N Lindenthal
          last edited by

          Jim, thank you very much.

          It took some time to understand, that I have to copy your script lines in one line, separated by ;, as you see here:

          page = Sketchup.active_model.pages["Szene 1"]; Sketchup.active_model.pages.selected_page=page
          

          Now your script works. Phantastic!

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            You can write it as two lines without the semicolon ; The semicolon is not necessary in Ruby.

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              I would guess when the lines were copied and pasted, maybe they wrapped in such a way that they appeared to be 2 lines but were really one. Or possibly the newline wasn't copied correctly. Just replace the semi-colon with a newline.

              Hi

              1 Reply Last reply Reply Quote 0
              • N Offline
                N Lindenthal
                last edited by

                On my Mac it runs with semi-colon, but not with newline.

                1 Reply Last reply Reply Quote 0
                • snicoloS Offline
                  snicolo
                  last edited by

                  You need to use the semicolon if you want to type it as one line in the Ruby Console.
                  The ruby console does not understand newlines.

                  However, If you are using it in a ruby script that you then load from the console Jim is right and there is no need for semicolons, Ruby is semicolon free.

                  πŸ˜‰
                  thanks.
                  Simone.

                  Simone Nicolo
                  QA Manager
                  http://www.sketchup.com

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    N Lindenthal
                    last edited by

                    Thanks for good explanation.

                    I see, I told not clearly, to type the only one script line in the ruby console.

                    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