Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SaveAs in SketchUp plugin corrupts measures in model #754

Closed
DavidGoldwasser opened this issue Dec 30, 2013 · 11 comments
Closed

SaveAs in SketchUp plugin corrupts measures in model #754

DavidGoldwasser opened this issue Dec 30, 2013 · 11 comments

Comments

@DavidGoldwasser
Copy link
Collaborator

cc: @elainethale

Dan, I assigned this to you since it relates to the SketchUp Plugin. It seems that SaveAs in the plugin doesn't behave the same as SaveAs in the OS app.

I made a project that had reporting measures. I then went back to SketchUp to make changes, saved as another name. The reporting measures were now shown as OpenStudio measures. The left side of the image below is the before-SaveAs model. The right is the model after using SaveAs in the plugin, and then re-opening it in the Plugin.

I'm using the installed version of OpenStudio 1.2

I don't know about the stability of the model after deleting the measures. I may test and see how it behaves, but I may have to throw away the project and go back to just the OSM?

12-30-2013 12-49-59 pm

@ghost ghost assigned macumber Dec 30, 2013
@macumber
Copy link
Contributor

@DavidGoldwasser @elainethale I would wait to fix this until we fix the model directory stuff, this is scheduled for this quarter but we could try to move it up ASAP

@macumber
Copy link
Contributor

@elainethale You and I should figure out the plan to get to the model dir refactor. We need to get the workflow serialized to something besides an OSP as one prerequisite, I'm not sure if there are others?

@elainethale
Copy link
Member

@macumber Getting the workflow serialized to something else is a prerequisite, but that can already be done. The item that is not done is refactoring the code that manages measure libraries and a model's/project's scripts folder into one or more utilities-level classes. That can be done as part of https://www.pivotaltracker.com/story/show/62870462. Then I think we will be ready to make "ModelDir". An additional nice-to-have/may-be-necessary before making ModelDir is to pull WorkItem, Job, JobErrors, etc. down into utilities.

@macumber
Copy link
Contributor

@DavidGoldwasser the code involved here is a bit of a mess, looking at it i dont think save as is working in the app, specifically it does not appear to be moving m_simpleProject. Can you try the following tests:

Create an osm, add some measures, without saving first call save as, close current model and open new model

Create an osm, add some measures, without saving first call save as, run current model

Do those workflows work?

@macumber
Copy link
Contributor

@elainethale Could you take a look at

OSDocument::save
OSDocument::saveAs

C:\working\openstudio\openstudiocore\src\openstudio_lib\FileOperations.cpp
saveModel
saveModelTempDir

to make sure we are doing the right things with the osp?

@elainethale
Copy link
Member

@macumber It looks like maybe OSDocument::saveAs() needs to save m_project before calling saveModelTempDir. (Copying the osp is sufficient, but it needs to contain all the current data, and may not if we don't m_project->save() first.) OSDocument::save() contains the proper m_project->save() code (first checks to make sure the analysis is in a good state).

@macumber
Copy link
Contributor

@elainethale doesn't some sort of call to update paths need to happen too?

@elainethale
Copy link
Member

@macumber That happens when you open an osp. Here, the real osp is in the temp dir. The updating for the saved version can happen whenever that file is re-opened (and also copied to a new temp dir).

@DavidGoldwasser
Copy link
Collaborator Author

@macumber and @elainethale this may affect save as well, not just SaveAs. Lincoln has reported crashes in this this situation.

https://openstudio.nrel.gov/forums/openstudio-application/bug-reports-and-feature-requests/application-crashes-when-measures-are#comment-3273

@macumber
Copy link
Contributor

@DavidGoldwasser I am not able to reproduce this on current develop. Can you retest with the release candidate next week and make sure this is still valid?

@macumber
Copy link
Contributor

@DavidGoldwasser it is true that if you change your OSP in the app but nothing in the OSM then save it the plugin will not detect this as a change if you have that OSM open in the plugin. In that case if you save from the plugin again you will lose the changes you made to your OSP. However, that is out of the scope of this ticket right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants