sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SketchUp Command Line: RubyStartup

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 7 Posters 11.7k Views 7 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.
    • J Offline
      Jim
      last edited by

      Apparently there is a command-line option to Sketchup that accepts the path to a ruby script and runs the script at start-up.

      > Sketchup.exe -RubyStartup c:\test_script.rb

      via: http://www.youtube.com/watch?v=_NBSN_87F9U

      Hi

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

        Well that's very interesting.
        It's not mentioned in the API docs, is it?

        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

          BUT a script in Plugins in the form
          ` def xxx()

          do some stuff

          end
          xxx()`
          does exactly that ?

          TIG

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

            yup, but you can use this as a debug one of feature, since the .rb isn't in the plugins folder.
            You can have some various maintenance or debug scripts - launched with different shortcuts.

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

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Is there a CLI parameter to force the display of the Sketchup Welcome screen?

              I cannot figure out how to get it back once I have chosen a Template, and checked the box "make this the default."

              I've tried clearing the path for "Preferences" > "DefaultTemplate" registry attribute.
              Does not work.

              I've tried deleting the whole attribute.
              Does not work.

              I tried commenting out the DEFAULT_TEMPLATE= line in the i18n.dat file.
              Does not work.

              Sketchup just opens a new model and grabs the DefaultLocation from the i18n.dat file (which I want to happen,) but ignores the Units settings from the i18n.dat file (boohoo, it uses the Unit settings in the registry.)

              OK.. wait. I see the registry setting! It's:
              "WelcomeDialog" > "ShowOnStartup" > (DWORD) 0 | 1
              which means (currently,) Sketchup.write_default will not change it.

              I cannot find any UI control to go back to using the Welcome Screen. Am I missing it?

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @dan rathbun said:

                I cannot find any UI control to go back to using the Welcome Screen. Am I missing it?

                Yes ( I says to myself, ) your missing it.

                @unknownuser said:

                (http://sketchup.google.com/support/bin/answer.py?hl)":1v1s8k0d]

                Always Show on Startup Checkbox

                Check the 'Always Show on Startup' button to display the Welcome to SketchUp dialog box when you launch SketchUp.

                Uncheck the 'Always Show on Startup' button to never show the Welcome to Sketchup dialog box when you launch SketchUp.

                Use the "Welcome to SketchUp..." menu item on the Help menu to display the Welcome to SketchUp dialog box.

                So going through the Help menu, allows access to the "Show on Startup" checkbox (which will toggle the Registry setting that I spoke of in my previous post.)

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • C Offline
                  cjthompson
                  last edited by

                  there is also a "ShowOnStartup" key under the WelcomeDialog folder in the registry.
                  EDIT: Nevermind, I should have read the full post. 😳

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

                    It might be useful if, for some reason, the user is unable to install scripts in the Plugins folder.

                    I wonder if the specified script is loaded before other scripts, after other scripts, or neither.

                    Hi

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

                      In that video @22:48 - that "Developer Console" ... internal Google tool, or one of the consoles made by people here?

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

                      1 Reply Last reply Reply Quote 0
                      • Al HartA Offline
                        Al Hart
                        last edited by

                        @tig said:

                        BUT a script in Plugins in the form
                        ` def xxx()

                        do some stuff

                        end
                        xxx()`
                        does exactly that ?

                        We use a solution like this when we export a model from ARRIS CAD and import it into SketchUp. We create a temporary .rb file to load the saved geometry - (saved as a ruby file to draw the geometry desired) - and then delete the temporary file.

                        However, running a ruby script from the command line would be a much better solution.

                        Al Hart

                        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                        IRender nXt from Render Plus

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @jim said:

                          Apparently there is a command-line option to Sketchup that accepts the path to a ruby script and runs the script at start-up.

                          Would be nice, I can see uses.

                          Tried it on Windows. Does not work. Either it's a Mac only thing, or he had a "special/internal" compiled version.

                          I'm not here much anymore.

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

                            @al hart said:

                            @tig said:

                            BUT a script in Plugins in the form
                            ` def xxx()

                            do some stuff

                            end
                            xxx()`
                            does exactly that ?

                            We use a solution like this when we export a model from ARRIS CAD and import it into SketchUp. We create a temporary .rb file to load the saved geometry - (saved as a ruby file to draw the geometry desired) - and then delete the temporary file.
                            However, running a ruby script from the command line would be a much better solution.

                            With appropriate premade file you can just type at the command line in the Ruby Console load'xxx.txt'
                            The .txt file [which is inside the ../Plugins/ folder] is actually a Ruby script, but without the usual .rb file extension it won't auto-load - but it will load to order.
                            Inside of the script you have the closing 'xxx()' [after the 'def..end'] so it will auto-run itself once loaded. 😕
                            Rarely do you need a temporary .rb - a temporary .cmd/.command file [PC/MAC] is another matter...
                            You could of course load a ruby-command at startup in the usual .rb way but have it take arguments, e.g.
                            def xxx(a=nil,b=[],c=0) ###do stuff using a, b, c etc end
                            Then you run it from inside another script with a line like
                            xxx(selection[0], selection[0].faces, 2) say to process a selected entity [edge], its faces and an option '2'.
                            If you don't pass an argument value it also does an action in the form if not a... etc
                            OR it will run from the Ruby Console in the same form - perhaps after you've set 'a' as xxx a, a.faces, 2
                            ☀

                            TIG

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

                              @dan rathbun said:

                              @jim said:

                              Apparently there is a command-line option to Sketchup that accepts the path to a ruby script and runs the script at start-up.

                              Would be nice, I can see uses.

                              Tried it on Windows. Does not work. Either it's a Mac only thing, or he had a "special/internal" compiled version.

                              It worked for me on SU7.1 and Win XP.

                              Hi

                              1 Reply Last reply Reply Quote 0
                              • Dan RathbunD Offline
                                Dan Rathbun
                                last edited by

                                @jim said:

                                It worked for me on SU7.1 and Win XP.

                                OK.. may be a Pro ONLY feature then.

                                I'm not here much anymore.

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

                                  Dan, this worked fine on versions 6 Free and 7 Free.

                                  Hi

                                  1 Reply Last reply Reply Quote 0
                                  • Dan RathbunD Offline
                                    Dan Rathbun
                                    last edited by

                                    @jim said:

                                    Dan, this worked fine on versions 6 Free and 7 Free.

                                    Well... then it appears to need an absolute path. I tried it by going to the SU folder I think.
                                    When Sketchup loads it sets the cwd to HOME (%UserProfile%) so that defeats any change in the directory I made prior to the command.
                                    .

                                    I'm not here much anymore.

                                    1 Reply Last reply Reply Quote 0
                                    • Dan RathbunD Offline
                                      Dan Rathbun
                                      last edited by

                                      @thomthom said:

                                      In that video @22:48 - that "Developer Console" ... internal Google tool, or one of the consoles made by people here?

                                      I looked at that Thom, it's simply a BASH shell window (or whatever system shell he's using.)

                                      Ya know, Windows used to have a clone of that shell window, Win95 or Win98. I loved it! Then Win2000 (which is NT,) has nothing but a frame with a scrollbar, and that crummy system menu. It is a royal pain just to cut and paste !! Why didn't MS port the cmd window to NT ??

                                      I'm not here much anymore.

                                      1 Reply Last reply Reply Quote 0
                                      • M Offline
                                        macumber
                                        last edited by

                                        This is very interesting, thanks for sharing, are there other command line arguments to SketchUp? SketchUp.exe --help, /?, etc just launches the program...

                                        Dan

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

                                          After that video, I went looking and found a few:

                                          -template "/path/to/template.skp" # startup template
                                          -notemplate # use no template
                                          -page "Scene 1" # set the staring scene
                                          -timing # some sort of test?

                                          There's more, if you search the .exe for these strings.

                                          Hi

                                          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