-
Notifications
You must be signed in to change notification settings - Fork 19
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
Can't exit app embedded #919
Comments
Hi @jorzig1990 , Thanks for opening the issue. PyMechanical embedding will not allow to create multiple app in same script. import ansys.mechanical.core as mech
print()
print("Run 1")
print()
app = mech.App(version=242)
app.update_globals(globals())
print("AnsysVersion:")
print(app)
DataModel = app.DataModel
ExtAPI = app.ExtAPI
Model = app.DataModel.Project.Model
Tree = app.DataModel.Tree
Graphics = app.ExtAPI.Graphics
Materials = DataModel.Project.Model.Materials
print()
print("Run 2")
print()
app.new()
print("AnsysVersion:")
print(app)
DataModel = app.DataModel
ExtAPI = app.ExtAPI
Model = app.DataModel.Project.Model
Tree = app.DataModel.Tree
Graphics = app.ExtAPI.Graphics
Materials = DataModel.Project.Model.Materials |
Hi @dipinknair, Thank you for the support. Is there a solution to reconnect or restart with the app, if I have lost the license connection or it crashed for some other reason? |
The app created in python which only stays till it crashes. No other way to connect it. You can always save your project ( .mechdb/ .mechdat) in between to make sure you can use that if your workflow crashes. |
🔍 Before submitting the issue
🐞 Description of the bug
Hello,
I want to implement following workflow in pymechanical as en embedded instance:
launch app embedded
exit app embedded
launch new app embedded
I need this workflow in a larger script in case an error occurs, such as the loss of a licence, and I need to set up a new connection automatically at a later time.
My poblem is, that I can't close the app completely and get allways an error, if I want to launch a new app.
Under Discussion I found the Topic: How to close app? #475 with following answer:
I tried all these commands, but the error message is always the same:
I am using Visual Studio Code and for the execution of the code:
📝 Steps to reproduce
I have tested all 3 versions from the answer in the discussion:
Test ExtAPI.Application.Exit()
Output ExtAPI.Application.Exit():
Test app.exit()
Output app.exit():
Test ExtAPI.Application.Close():
Output ExtAPI.Application.Close()
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
AnsysVersion:
Ansys Mechanical [Ansys Mechanical Enterprise]
Product Version:242
Software build date: 06/03/2024 14:47:58
Python 3.11.9
Environment completely built with pip
🐍 Which Python version are you using?
3.11
📦 Installed packages
The text was updated successfully, but these errors were encountered: