SketchUp Command Line: RubyStartup
-
Well that's very interesting.
It's not mentioned in the API docs, is it? -
BUT a script in Plugins in the form
` def xxx()do some stuff
end
xxx()`
does exactly that ? -
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. -
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?
-
@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.)
-
there is also a "ShowOnStartup" key under the WelcomeDialog folder in the registry.
EDIT: Nevermind, I should have read the full post. -
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.
-
In that video @22:48 - that "Developer Console" ... internal Google tool, or one of the consoles made by people here?
-
@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.
-
@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.
-
@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 formif not a...
etc
OR it will run from the Ruby Console in the same form - perhaps after you've set 'a' asxxx a, a.faces, 2
-
@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.
-
-
Dan, this worked fine on versions 6 Free and 7 Free.
-
@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.
. -
@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 ??
-
This is very interesting, thanks for sharing, are there other command line arguments to SketchUp? SketchUp.exe --help, /?, etc just launches the program...
Dan
-
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.
Advertisement