Generate report from Ruby API


There is a “Generate Report” functionality in SketchUp. Is there any way to do this from Ruby API? I do not want to open that window, etc, just click on a button which generates the report file automatically. Could you provide an example code for this please? Thank you.

There is no dedicated API class (that I know of) to manipulate and run reports as this feature is a web-based platform. (The user must be connected to the internet to see the newest version of the interface with custom report builder. Otherwise the old local interface with hard set report options is shown.)

The reason they switched to web-based is so that they can update and improve it at anytime independent from the application’s update cycle.

You can open a feature request in the official API tracker:

But I don’t think it would be anything more than firing off a predesigned report.

A more complex report API might stifle innovation in the generator and it’s interface.

There is no send action to open the window anyway. (We cannot use send_action to send a command ID, because SketchUp assigns a command ID “on the fly” as it loads, so this ID can be different each time depending upon what other commands get loaded.)

A shortcut would need to be assigned to the menu command and then a key sender used to bring up the window.

Not specifically the native SketchUp “Generate Report” feature, but creating text files and reports is one of the basic features of the core Ruby programming language.

There are numerous topic threads here about “walking” the model hierarchy and collecting information for export. (A text report written to a file is he simplest form of export.)

Thank you for your answer! Actually I need the dimension and the color of each component in the model saved to a CSV file.
So I guess I should find the components somehow in the model and get their properties. Can you send the link of a thread where I can find information about how to “walk” the model hierarchy?
I found this one: Getting a list of Component from current collection
but I don’t think this is what I need…
Thank you!

Sorry I’m busy for awhile. There are quite a few I’m sure. Learn to use the forum’s search feature and advanced search form.

I understand there is no way to run online Reports Generator in Ruby. But is there a way to run built in v1 generator in Ruby, so that we do not need to turn off internet connection if we want to do that? There are some limitations of online reports which result in need or using the built in v1 report…

I cannot find a send action to do this.

Perhaps there is something internal ? @tt_su ?

Or maybe some other Ideas to Generate Reports v1 without closing Sketchup, disabling internet conection and reopening Sketchup?

A few days ago I tried it, and did not need to close SketchUp. Just disconnected my network cable and after the taskbar showed my internet connection was off, I did the report command and got the old v1 interface.

I do know how to send key stokes to SketchUp on Windows but not on mac. Some Mac users have used the cliclick utility on Mac to do keystroke macros. You would use it with Ruby’s %x command strings (which use the global backquote method.)

Here is one of J Boundy’s examples… (note, he no longer frequents these forums) …
Changing active_entities within a tool - #3 by john_drivenupthewall

On a Mac I get a bug on the screen when I try to do it.

I did see this yesterday on my PC whist testing with my network cable disconnected. It was because of some error (which I think was due to either SketchUp thinking I was offline or network latency issues.)

Regardless …

My bad ! There actually is, but I had forgotten. In another conversation about components I was reminded of previous posts I had answered in the Dynamic Components category.

There is a method that can be called to open the Generate Report interface window. Does not help much with automation as a person still needs to click buttons and and use the save file dialog to have a report file generated.


Where would you wish to save these CSV report files ? (see comment below)

I did find a way to do this without the reporter interface.

However, the v1 generation code does not honor a passed in filepath and always prompts the user for a file location and filename. It also is written so that the “Save As” dialog will open at the last location that the operating system thinks a .csv file was saved in.

@mtamas &
How much do you guys know about setting up a SketchupExtension registrar script and folder hierarchy and creating toolbar button images ?