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

CreateResultsAtAllSets() not generating any results. #1002

Open
2 tasks done
anthony-walker opened this issue Dec 9, 2024 · 3 comments
Open
2 tasks done

CreateResultsAtAllSets() not generating any results. #1002

anthony-walker opened this issue Dec 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@anthony-walker
Copy link

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

I am using Ansys 2024 R2 and trying to programmatically generate needed linear stress results. I get two different results using the same code internally and externally. Specifically the external script does not create results sets.

In my project I record to click operations to generate the following.

solution_23 = DataModel.GetObjectById(23)
linearized_normal_stress_1680 = solution_23.AddLinearizedNormalStress()
path_849 = DataModel.GetObjectById(849)
linearized_normal_stress_1680.Path = path_849
linearized_normal_stress_1680.NormalOrientation = NormalOrientationType.YAxis
linearized_normal_stress_1680.Name = r"""SCL_YY"""
linearized_normal_stress_1680.EvaluateAllResults()
solution_23.CreateResultsAtAllSets(linearized_normal_stress_1680.ObjectId)
linearized_normal_stress_1680.EvaluateAllResults()

If I put this same script into a text file and execute it the results are not generated. The tree shows no change. Am I missing something simple? The primary portion is an exact copy of why Ansys Mechanical Generates so I am confused as to why it would not work.

import ansys.mechanical.core as mechanical

filename = ".\\demo-data\\cube_example_files\\dp0\\global\\MECH\\SYS.mechdb"

app = mechanical.App(str(filename))

app.update_globals(globals())
app.print_tree()

solution_23 = DataModel.GetObjectById(23)
linearized_normal_stress_1680 = solution_23.AddLinearizedNormalStress()
path_849 = DataModel.GetObjectById(849)
linearized_normal_stress_1680.Path = path_849
linearized_normal_stress_1680.NormalOrientation = NormalOrientationType.YAxis
linearized_normal_stress_1680.Name = r"""SCL_YY"""
linearized_normal_stress_1680.EvaluateAllResults()
solution_23.CreateResultsAtAllSets(linearized_normal_stress_1680.ObjectId)
linearized_normal_stress_1680.EvaluateAllResults()

app.print_tree(max_lines=-1)

📝 Steps to reproduce

Follow the steps described above.

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2024 R2

🐍 Which Python version are you using?

3.12

📦 Installed packages

alabaster==0.7.16
ansys-api-mechanical==0.1.2
ansys-api-platform-instancemanagement==1.1.0
ansys-dpf-core==0.13.0
ansys-mechanical-core==0.11.5
ansys-mechanical-env==0.1.7
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc3
ansys-tools-path==0.6.0
appdirs==1.4.4
asttokens==2.4.1
attrs==24.2.0
babel==2.16.0
cachetools==5.4.0
certifi==2024.7.4
cffi==1.17.0
charset-normalizer==3.3.2
click==8.1.7
clr-loader==0.2.6
colorama==0.4.6
coloredlogs==15.0.1
coverage==7.6.1
decorator==5.1.1
docutils==0.19
execnet==2.1.1
executing==2.0.1
flake8==7.1.1
Flake8-pyproject==1.2.3
google-api-core==2.19.1
google-api-python-client==2.141.0
google-auth==2.33.0
google-auth-httplib2==0.2.0
googleapis-common-protos==1.63.2
graphviz==0.20.3
grpcio==1.65.4
httplib2==0.22.0
humanfriendly==10.0
idna==3.7
imagesize==1.4.1
importlib_metadata==8.2.0
iniconfig==2.0.0
ipython==8.26.0
jedi==0.19.1
Jinja2==3.1.4
jsonschema==4.23.0
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib-inline==0.1.7
mccabe==0.7.0
mdit-py-plugins==0.4.1
mdurl==0.1.2
myst-parser==3.0.1
numpy==1.26.4
packaging==24.1
pandas==2.2.2
parso==0.8.4
pep8==1.7.1
platformdirs==4.2.2
pluggy==1.5.0
prompt_toolkit==3.0.47
proto-plus==1.24.0
protobuf==5.27.3
psutil==6.0.0
pure_eval==0.2.3
pyasn1==0.6.0
pyasn1_modules==0.4.0
pycodestyle==2.12.1
pycparser==2.22
pyflakes==3.2.0
Pygments==2.18.0
pyparsing==3.1.2
pyreadline3==3.4.1
pytest==8.3.2
pytest-cov==5.0.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.2
referencing==0.35.1
requests==2.32.3
requests-file==2.1.0
rpds-py==0.20.0
rsa==4.9
scipy==1.14.0
setuptools==72.1.0
six==1.16.0
snowballstemmer==2.2.0
Sphinx==6.2.1
sphinx-data-viewer==0.1.5
sphinx-needs==3.0.0
sphinx-rtd-theme==2.0.0
sphinx-test-reports==1.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-plantuml==0.30
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tqdm==4.66.5
traitlets==5.14.3
tzdata==2024.1
uritemplate==4.1.1
urllib3==2.2.2
wcwidth==0.2.13
wheel==0.44.0
xlrd==2.0.1
zipp==3.20.0
@anthony-walker anthony-walker added the bug Something isn't working label Dec 9, 2024
@anthony-walker
Copy link
Author

It seems that the sets aren't being created because the data is not cleared but the data clear fails

In [8]: solution.ClearGeneratedData()
2024-12-09 19:48:15.406346 (Thread 0x00006390) [POST.ReaderPluginMgr, error] --- : Request to instantiate unknown reader type
2024-12-09 19:48:15.407432 (Thread 0x00006390) [POST.ReaderPluginMgr, error] --- : Request to instantiate unknown reader type

In [9]: curr_lns.EvaluateAllResults()
2024-12-09 19:48:21.401400 (Thread 0x00006390) [POST, warning] ----------------- : Result repository message 0: "The result file  cannot be opened."
2024-12-09 19:48:21.401400 (Thread 0x00006390) [POST, warning] ----------------- : Result repository message 1: "Current result file may not contain requested result data . Please clear the solution and solve again."

@dipinknair
Copy link
Collaborator

@anthony-walker.

I tested with a simple model with same code but I am seeing no issues. May its specific to the file you are using. Could you please share the .mechdb files and script if possible? If you want to share directly, please email to [email protected] with title "pymechanical issue 1002 requested files"

@dipinknair
Copy link
Collaborator

@anthony-walker

solution_23 = DataModel.GetObjectById(23)
linearized_normal_stress_1680 = solution_23.AddLinearizedNormalStress()
path_849 = DataModel.GetObjectById(849)
linearized_normal_stress_1680.Path = path_849
linearized_normal_stress_1680.NormalOrientation = NormalOrientationType.YAxis
linearized_normal_stress_1680.Name = r"""SCL_YY"""
linearized_normal_stress_1680.EvaluateAllResults()
solution_23.CreateResultsAtAllSets(linearized_normal_stress_1680.ObjectId)
linearized_normal_stress_1680.EvaluateAllResults()
solution_23.ClearGeneratedData()
solution_23.Solve(True)

Adding below lines at the end works.

solution_23.ClearGeneratedData()
solution_23.Solve(True)

Please try and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants