• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Manipulate a ruby from command line?

Scheduled Pinned Locked Moved Developers' Forum
11 Posts 4 Posters 485 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.
  • M Offline
    mut
    last edited by 26 Oct 2010, 08:03

    Hey, just wondered if there was any way I could launch sketchup as follows: sketchup.exe -rubyname "string"

    essentially, I want a ruby script take the string, do some automated modelling based on what's in that string, and save the file... think this is possible?

    Thanks,

    Tom

    http://www.StairBox.com We make stairs... easy

    1 Reply Last reply Reply Quote 0
    • T Offline
      tbd
      last edited by 26 Oct 2010, 09:55

      see Sketchup Bridge - http://labs.plugins.ro/

      SketchUp Ruby Consultant | Podium 1.x developer
      http://plugins.ro

      1 Reply Last reply Reply Quote 0
      • H Offline
        honoluludesktop
        last edited by 26 Oct 2010, 18:29

        WOW!!!!!............

        1 Reply Last reply Reply Quote 0
        • M Offline
          mut
          last edited by 27 Oct 2010, 12:49

          hmm, I could do with a "hired gun" to get this sorted for me. do you guys know of anywhere I might be able to find someone?

          Thanks,

          Tom.

          http://www.StairBox.com We make stairs... easy

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by 27 Oct 2010, 15:06

            Yes, it's possible. It sounds like you want to batch-process some models. SketchUp won't run in any sort of window-less mode - the gui window is always opened.

            SketchUp does have a command-line switch that will execute a Ruby script:

            Sketchup.exe -RubyStartup "C:\Scripts\My Script.rb"

            Maybe related: Dan Rathbun posted some code for closing Sketchup here:
            http://forums.sketchucation.com/viewtopic.php?f=180&t=29162

            Hi

            1 Reply Last reply Reply Quote 0
            • M Offline
              mut
              last edited by 27 Oct 2010, 15:47

              you guys are very helpful.

              Jim, do you know if you could also send through a variable with the switch, like so:

              Sketchup.exe -RubyStartup "C:\Scripts\My Script.rb" -variable

              http://www.StairBox.com We make stairs... easy

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by 27 Oct 2010, 15:50

                No, but you could use an Environmental variable which is accessible via the script. Or simply have multiple scripts which hard-code the value in the script since you are able to select any script on the command-line.

                Hi

                1 Reply Last reply Reply Quote 0
                • M Offline
                  mut
                  last edited by 27 Oct 2010, 16:05

                  ah yes,

                  I guess I could insert a line into the ruby on the fly... basically a variable with the relevent string.

                  Ok, getting somewhere now!

                  1 more thing, I assume I could automate a save operation too?

                  thanks,

                  Tom.

                  http://www.StairBox.com We make stairs... easy

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by 27 Oct 2010, 16:11

                    You can save the whole model:
                    http://code.google.com/apis/sketchup/docs/ourdoc/model.html#save

                    Or you can save individual ComponentDefinitions:
                    http://code.google.com/apis/sketchup/docs/ourdoc/componentdefinition.html#save_as

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by 27 Oct 2010, 16:14

                      @mut said:

                      you guys are very helpful.

                      Jim, do you know if you could also send through a variable with the switch, like so:

                      Sketchup.exe -RubyStartup "C:\Scripts\My Script.rb" -variable

                      Let me correct my answer to: I don't know. It may be possible to pass arguments to the ruby script, although I have not tried:

                      Sketchup.exe -RubyStartup "c:\Scripts\My Script.rb SomeString"

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        mut
                        last edited by 27 Oct 2010, 21:01

                        ah, OK cheers Jim.

                        It looks like it will be possible one way or another!

                        now I know its possible, time to hunt down someone with the capabilities 😛

                        Thanks a lot for the help,

                        Tom

                        http://www.StairBox.com We make stairs... easy

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

                        Advertisement