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?
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)
@Erik Kostson said: 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)
@Erik Kostson said: Hi
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?
@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