Is it possible to run SketchUp ruby API with ruby in system not in SketchUp?

Is there any way to load the ruby scripts for sketchup neither in Sketchup ruby Console nor in the plugins or tools folder?

I also wanna call a ruby script to open the sketchup software, and then load a model and the corresponding extension.

Is it possible?


Since SketchUp’s Ruby runtime is started by (and runs inside) SketchUp: No.

If you just mean whether you can launch applications from a (separate, complete) installation of the Ruby language, yes (but then there is maybe no point in choosing Ruby) just as you could use any other language: bash, Python, Java, C, C++, Lua, …

@Aerilius took your question to mean “can I run a SketchUp Ruby extension without running SketchUp”. Since an extension makes calls to the internals of SketchUp, the answer is obviously no.

But if you mean “can I place SketchUp Ruby scripts in a non-standard folder”, the answer is yes - though some “bootstrap” script must be run either from the SketchUp Ruby Console or the standard folder to load them. SketchUp only knows by default to search its standard folders for Ruby to load.

Various extensions have used ad-hoc, non-standard folders in the past, though usually to store configuration or other customization data rather than Ruby scripts themselves. However, due to bad experience and maintenance issues this practice is now generally discouraged.

This raises the questions: what is your use case? why do you want to do this? Maybe there is a better answer…

I wanna create a small app to load a skp model and a ruby script by click the button created in Webdialog. It is like a validation process before load the model. I use php to call ruby while it never success probably because I am not using the ruby in Sketchup. I may think to use callback functions now. I’ll see.

It sounds like you need to read up on how WebDialogs work in SketchUp. They rely on a proprietary protocol to send callbacks to a Ruby script running within SketchUp. PHP runs Ruby within the server, but knows nothing about this protocol or callbacks to SketchUp. One good reference is