• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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 28 Jul 2009, 20:44

    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 28 Jul 2009, 21:01

      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 29 Jul 2009, 10:02

        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
        • C Offline
          Chris Fullmer
          last edited by 29 Jul 2009, 13:24

          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 29 Jul 2009, 13:32

            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 29 Jul 2009, 14:09

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

              1 Reply Last reply Reply Quote 0
              • S Offline
                snicolo
                last edited by 31 Jul 2009, 22:29

                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 1 Aug 2009, 05:11

                  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
                  1 / 1
                  • First post
                    1/8
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement