sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Manipulate a ruby from command line?

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 4 Posters 565 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

      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
      • tbdT Offline
        tbd
        last edited by

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

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

        1 Reply Last reply Reply Quote 0
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

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

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

            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

              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

                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

                  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

                    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

                      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

                        @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

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

                          Advertisement