Run an extension without opening sketchup?

Hello, I’m trying to automate some tasks with the ruby API. Is there a way I can run a ruby script using the API without entering sketchup?

I’m also getting the error “cannot load such file – sketchup.rb (LoadError)” when trying to use

require ‘sketchup.rb’

in my script.

more detail needed…

useless you start SU the Ruby interpreter isn’t running, as it’s an internal of SU…

john

thanks for the response, John.

I’m not sure what other detail I can add… right now to run my script I open sketchup, then select Extensions>MyExtension. Do you know of any way to run the interpeter, or something else, without the whole gui of sketchup running? I’d like to be able to just run MyExtension from the command line if possible.

what does the extension actually do?

john

You can’t run a script without having SketchUp open.
But therefater it should load and run if it exists in the Plugins folder, or the full path - which you need to specify.

The require ‘sketchup.rb’ should run when it’s run within SketchUp, but then it is only needed if you are calling some specific SketchUp methods…

You can provide a command line argument to run a Ruby script when opening SU: -RubyStartup "/path/to/ruby.rb"
(http://www.thomthom.net/thoughts/2013/04/sketchup-command-arguments/)

But you must start SketchUp. There is no head-less mode.

One alternative you could try is to just have a single instance of SU running that listens to a socket - avoiding the overhead of starting up.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.