How to export tabular data and local maximum and local minimum values in energy probe using Python
![sunyroy](https://us.v-cdn.net/6037473/uploads/defaultavatar/nJ0MPCXK3SI3C.jpg)
As shown in the figure, I need to export the data from these two places. How should I implement it with Python and run it in visual studio?
Also is there a way to realize the overall export operation of the table in the Python environment?
Answers
-
Hi
Perhaps start and try to use this in mechanical scripting inside the automation/script console or in a python code :
mprobe=ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.EnergyProbe)[0]
mprobe.Activate()and then see this post to get the values of the tabular data:
https://discuss.ansys.com/discussion/255/how-to-access-tabular-data-using-act
then perhaps loop/look through data to find what you want perhaps and write to a text file as needed to export.
Not sure if the above will always work if you run many simulations (say via batch)
0 -
@Erik Kostson said:
HiPerhaps start and try to use this in mechanical scripting inside the automation/script console or in a python code :
mprobe=ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.EnergyProbe)[0]
mprobe.Activate()and then see this post to get the values of the tabular data:
https://discuss.ansys.com/discussion/255/how-to-access-tabular-data-using-act
then perhaps loop/look through data to find what you want perhaps and write to a text file as needed to export.
Not sure if the above will always work if you run many simulations (say via batch)
Hello, thank you very much for your answer, but when I run this code in visual studio software, it prompts "NameError: name 'MechanicalPanelEnum' is not defined". Is there any way to export this data in Python 3.9 environment?
0 -
@sunyroy You can import those global variable like this:
app.update_globals(globals(), True)
https://mechanical.docs.pyansys.com/version/stable/user_guide_embedding/globals.html#globals
0