Ruby Console not generating anything

Hello, I’m trying to use the ruby console to generate a model based off of the code I’m putting in, but nothing in being generated. I’m not getting any error messages, I’m not getting any popups, it’s just that literally nothing is happening. When I type:

puts “Hello World”

into the bottom box (which seems to be the test to make sure it’s working), the text moves from the bottom box of Ruby Console to the top box of Ruby Console, and then nothing else happens. I don’t think I have any layers hidden. When I do the “Zoom Extents”, it just zooms me out to a random spot because there’s no model to show.

Can anyone point me in a direction? I’m using Sketchup 2026

If you look closely, you can see that in addition to what you typed above, you can also see the output

puts write the String “Hello World” to the console,
and returns nil
So, it does what it needs to do. It does not create anything to the model.

If you want to Draw Something, look e.g. here
(https://developer.sketchup.com/article-writing-your-first-code)

__

Other places you can start:

https://forums.sketchup.com/t/ruby-learning-resources-wikilists

https://ruby.sketchup.com/index.html

2 Likes

When you type

puts "Hello World"

into the bottom (input) part of the Ruby Console and then press return, in the upper (output) part you should see

puts "Hello World"
Hello World
=> nil

and the bottom part should clear. The top part is showing the input first, then the output it produced, then the returned value from executing the command (after the arrow). If you are not seeing that there is something wrong with your installation.

@dezmo told you the same thing while I was typing.

That command will not do anything to the model, so you should not expect to see any new tags or other changes to the model.

Regarding anything else you enter, you will need to share an example with us before we can comment on why it is or is not working.

2 Likes

"Zoom Extents" is not a valid Ruby statement. It will cause an exception.

The proper method calls are:

Sketchup.active_model.active_view.zoom_extents

But yes, if the model is empty, it has no extents. So draw something and then try the call.