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

How to know if OpenStudio Plugin opens or saves a file

asked 2015-08-08 17:17:28 -0600

updated 2015-08-10 16:27:55 -0600

I have a plugin that uses OpenStudio model and then I have my own system for thermal bridges. Now I have to save my external info in a separate file. It would be really cool if there be an event system in the OpenStudio plugin so I can know if the model is loaded or saved so I can load/save my own. I think I can do this by monkey-patching the main save and load functions but I want to know if there is any better way far that

edit retag flag offensive close merge delete


By the way, thanks for adding the term 'monkey-patching' to my lexicon. I plan to use it heavily going forward. With attribution of course!

__AmirRoth__ gravatar image __AmirRoth__  ( 2015-08-10 14:05:43 -0600 )edit

@__AmirRoth__ you're welcome, Thank a lot for "always fixing my posts" ! (talking about that, I'm not very sure if adding the term to the tags actually helps...)

Pouya Kary gravatar image Pouya Kary  ( 2015-08-10 16:06:56 -0600 )edit

Yes, I often retag posts to make sure that they include tags that people subscribe to, so that the message finds its way to the right inboxes. You're right, monkey-patching is not a good tag since nobody subscribes to it. I removed it. It is funny though.

__AmirRoth__ gravatar image __AmirRoth__  ( 2015-08-10 16:29:23 -0600 )edit

@__AmirRoth__ yeah I always see you change the 'openstudio-measures' to the 'openstudio-measure'. It's really cool that you organize here like this :D

Pouya Kary gravatar image Pouya Kary  ( 2015-08-10 16:33:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-10 10:14:08 -0600

@macumber added code to the OpenStudio SketchUp plugin that watches to see if the OSM file was saved by something other than the SketchUp plugin. This was done to alert the user to re-load the file if they opened and altered it (and saved it) using the stand alone OpenStudio application and then came back to the plugin. This is in PluginPathWatcher.rb

Maybe you can use code similar to this within your thermal bridge tool to see if there is an updated OSM available.

edit flag offensive delete link more


Okay that actually helped a lot. (funny that I were reading the code yesterday and I didn't see this one) and still thanks a lot for answering me all the time :) (also congrats on your 5K karma!)

Pouya Kary gravatar image Pouya Kary  ( 2015-08-10 16:17:15 -0600 )edit

Thanks @macumber. I really like that it automatically prompts me to reload once I delete messed up surfaces or subsurfaces in notepad++.

@pmkary: if satisfied, make sure to mark the answer as accepted so that we can close it.

Julien Marrec gravatar image Julien Marrec  ( 2015-08-11 00:49:46 -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

Question Tools

1 follower


Asked: 2015-08-08 17:17:28 -0600

Seen: 195 times

Last updated: Aug 10 '15