3

How to know if OpenStudio Plugin opens or saves a file

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

Pouya Kary's avatar
369
Pouya Kary
asked 2015-08-08 17:17:28 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2015-08-10 16:27:55 -0500
edit flag offensive 0 remove flag close merge delete

Comments

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__'s avatar __AmirRoth__ (2015-08-10 14:05:43 -0500) 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's avatar Pouya Kary (2015-08-10 16:06:56 -0500) 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__'s avatar __AmirRoth__ (2015-08-10 16:29:23 -0500) 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's avatar Pouya Kary (2015-08-10 16:33:34 -0500) edit
add a comment see more comments

1 Answer

3

@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.

David Goldwasser's avatar
20.4k
David Goldwasser
answered 2015-08-10 10:14:08 -0500
edit flag offensive 0 remove flag delete link

Comments

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's avatar Pouya Kary (2015-08-10 16:17:15 -0500) 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's avatar Julien Marrec (2015-08-11 00:49:46 -0500) edit
add a comment see more comments