Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
5

How do you access the current model in the Sketchup ruby console?

asked 2016-01-13 09:12:22 -0600

updated 2016-01-13 09:25:40 -0600

I'm trying to do a custom filter for surface and would like to see the resulting ones (to go above and beyond the "filter tool"), and would like to write some lines of code directly in the sketchup ruby console, but I'm unclear on how to select the current model, so I can do stuff like model.getSurfaces.

How can I access the current model in the Sketchup ruby console?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2016-01-13 09:30:07 -0600

I think I got it from searching the source code:

In [1]: sketchup_model = Sketchup.active_model
In [2]:model = sketchup_model.model_interface.openstudio_model
In [3]:model.class
Out[3]: OpenStudio::Model::Model
edit flag offensive delete link more

Comments

That's the secret code, be careful you can break things using the Ruby console. Another line that might be useful to you is

Sketchup.active_model.selection[0].drawing_interface.model_object

which gets the OpenStudio ModelObject for the currently selected SketchUp object.

macumber's avatar macumber  ( 2016-01-13 11:21:55 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2016-01-13 09:12:22 -0600

Seen: 513 times

Last updated: Jan 13 '16