Manipulate a ruby from command line?
-
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
-
see Sketchup Bridge - http://labs.plugins.ro/
-
WOW!!!!!............
-
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.
-
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 -
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
-
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.
-
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.
-
You can save the whole model:
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#saveOr you can save individual ComponentDefinitions:
http://code.google.com/apis/sketchup/docs/ourdoc/componentdefinition.html#save_as -
@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" -
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement