Skip to content

Conversation

@MeenaBytes
Copy link
Collaborator

app.save() should be able to save already saved project as well. if we send None in DataModel.Project.Save(None) mechanical API then it throws error "Null or Empty File Path."

image

This is fix for issue: #451

@MeenaBytes
Copy link
Collaborator Author

MeenaBytes commented Oct 10, 2023

I am not sure how the test cases (https://github.com/ansys/pymechanical/actions/runs/6473844751/job/17577477416#step:11:55) are being passed successfully earlier as well.

With below snippet, I am able to reproduce.

`
from ansys.mechanical.core import embedding as app

from ansys.mechanical.core import global_variables

embedded_app = app.App(version=241)

globals().update(global_variables(embedded_app))

embedded_app.save("D:/test123.mechdat")
embedded_app.save()
`

@MeenaBytes MeenaBytes requested a review from koubaa October 10, 2023 20:26
@MeenaBytes MeenaBytes marked this pull request as ready for review October 10, 2023 20:26
@MeenaBytes
Copy link
Collaborator Author

This seems to be the behavior starting from 2024R1. Older versions take None as input to the DataModel.Project.Save(None). We can either revert the behavior in Mechanical API or we can make change in embedding source code to accommodate the new behavior.

@koubaa
Copy link
Collaborator

koubaa commented Oct 11, 2023

@rajesh1359 I confirm that there was a change in 241. Passing a path to ExtAPI.Project.Save() is now obsolete, and if the path passed in is null or empty, it throws an error (your change only checks for null, not empty). Since we already have a save_as(path) option on app, do you think we can remove the path argument from save (even for <241)?

@MeenaBytes
Copy link
Collaborator Author

@koubaa Typically while saving the new project first time, user would use app.save(path) instead of app.save_as(path) (although mechanical API recommends using SaveAs). we should continue to take path input in app.save as well.

@koubaa koubaa merged commit 9ecfc56 into main Oct 11, 2023
@koubaa koubaa deleted the bug/app_save_fix branch October 11, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants