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