Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question
3

How to use OpenStudio model in a SketchUp Plugin?

asked 2015-07-29 07:23:09 -0600

updated 2015-11-10 20:46:34 -0600

Before I even begin to ask there is this thing that I've been asking too many questions and well I wanted to thank you all for the generous time you put to answer all those questions.

I've been developing a software for evaluating a standard. And that has been developed from a very simple code into a very giant one and well because we wanted to contain OpenStudio compatibility I wrote it as an OpenStudio/SketchUp plugin and that actually was good at first. But the problem now is there are a lot of tools (A OpenStudio/SketchUp user script, A web tech based result explorer and a SketchUp plugin for editing thermal bridges and a lot of other small stuff). And for now there too much of problems with this. (I have to develop my own installers and a updater outside of SketchUp each for both Mac and Windows, Also I need some protocols to connect languages and data files and SketchUp web dialogs seems to be a bit of unstable inside the OpenStudio user scripts)

So it actually would be very good to be a bit OpenStudio independent and gather all those stuff into one SketchUp plugin. the only problem is I don't know how to access the OpenStudio plugin features from another plugin. Is it even possible?

Thanks a lot!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-07-29 09:50:38 -0600

updated 2015-07-29 09:52:10 -0600

@Pouya Kary I think I have a good example for you. I wanted to create a very light weight workflow for creating and editing OpenStudio models in SketchUp that applied data directly to attribute libraries of native SketchUp objects.

My first experiment was the experimental workflow user script which is included in the OpenStudio SketchUp Plugin, but this still requires the full plugin to be running to access OpenStudio methods.

Back over New Year's weekend I had time to try the next step which is to pull this functionality into a stand alone plugin that can run without the OpenStudio SketchUp plugin installed. That plugin, su2osm, is on a GitHub repo.

image description

The modeling and render mode elements of that plugin don't even require OpenStudio in any form to be installed on your machine, I used SketchUp's native paint bucket to create a render mode aware space attributes tool. In this workflow you would save only a native SketchUp file. However the functionality to import from and export to an OSM from a 'structured' sketchup model does require OpenStudio on your machine. I added a dialog in the plugins preferences menu, shown below, that takes a string argument. This tells your plugin where to find OpenStudio. At that point you can add code much like you would in a standard OpenStudio measure, but you still also have access to the SketchUp API.

image description

Since I don't bring in the full model, just geometry and stub space attributes, the OpenStudio API would also be used if I added inferred render modes based on model inputs like render by Air Loop or LPD. If I ever get back to this I'd like to add in an "Apply Measure Now" feature using real measures, vs. just user scripts.

This plugin only consists of 8 files, so it shouldn't take you long to see how the different elements work. Here is the script that stores the path to OpenStudio.

edit flag offensive delete link more

Comments

wow! thanks! you always help so much. The thing is the su2osm is awesome and actually after a bit of checking it out OpenStudio::Model::Model::load(OpenStudio::Path.new(merge_path)).get was the exactly the thing I wanted to find. Thanks a lot!

Pouya Kary gravatar image Pouya Kary  ( 2015-07-29 13:21:51 -0600 )edit

Glad you found what you needed.

David Goldwasser gravatar image David Goldwasser  ( 2015-08-03 12:16:20 -0600 )edit

Your Answer

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

Add Answer

 

Question Tools

1 follower

Stats

Asked: 2015-07-29 07:23:09 -0600

Seen: 326 times

Last updated: Jul 29 '15