-
-
November 7, 2023 at 12:40 pmElena MaierSubscriber
Hello,
I perform a parameter study in which I am interested in the results from the fracture tool and in specific in the SIFS.
I have a lot of different design points.
Is there a way to calculate all the design points using "update all design points" and at the same time export all the data for the different SIFSs (in a external file).Because I need the complete plot, all SIFS for my parameter study and it is really inefficient to "set as current" and then "open modell" with every design point. And over the normal function I can only see Kmin and Kmax.
Thank you so much in advance.
Elena -
November 7, 2023 at 2:56 pmElena MaierSubscriber
I already tried to use the ACT-extension for MultiObjectExport. But I dont know what to put in "Object Base Name", because if i put in "SIFS (K1") or "Fracture Tool" it says that doesn´t exist and can´t be exported. Also if I run all design points it does not export the data automatically. Is there any solution to fix this?
-
November 8, 2023 at 2:19 pmRohith PatchigollaAnsys Employee
Hello,
We can export the results using Mechanical scripting. To automate this process, we can include the mechanical script inside "Python Code" object under Solution. However, this is valid from v2021R2.Is it possible for you to upgrade?
Best regards,
Rohith -
November 8, 2023 at 4:01 pmElena MaierSubscriber
That sounds good, I am working with v2021R1, would that version work too or just from R2 on?
(Otherwise I can try to get access for v2022R1.)
Where exactly would I put the Python Code?
Best regards and thank you so much
Elena -
November 8, 2023 at 4:05 pmRohith PatchigollaAnsys Employee
The "Python Code" object has been introduced in Mechanical since 2021R2. So, using 2021R2 or newer should work.
You can RMB on Solution --> Insert --> Python Code (with Target Callback --> After Post)
Please create first a Mechanical script to automate the export of results. You can use Scripting Console in Mechanical develop this script. Then you can plug this into Python Code object to do the export automatically after solving the model.
-
November 13, 2023 at 2:55 pmElena MaierSubscriber
It would be great, if you could help me with the code, because I can´t find information, how to access the Stress intensity factor SIFS and also how to export the data as a table. And how to export more than the current design point information.
To solve this could really help me and save so much time.
Looking forward to an answer.
-
-
November 9, 2023 at 10:28 amElena MaierSubscriber
Thank you again, I got access to v2022R1 and I can insert a Python Code now.
I insertet this code:def after_post(this, solution):
import os
import wbjn# Get Design Point Number as Text (to append it to the file name)
dpn = wbjn.ExecuteCommand(ExtAPI, “returnValue(a+Parameters.GetActiveDesignPoint().Name)”, a=”DP”)# Get the User Files Directory of the Project to save files.
UserFilesDir = wbjn.ExecuteCommand(ExtAPI, “returnValue(GetUserFilesDirectory())”)for analysis in ExtAPI.DataModel.AnalysisList:
# Get all the results objects in the analysis tree
results = [child for child in analysis.Solution.Children]for result in results:
if result.DataModelObjectCategory == DataModelObjectCategory.SIFResult: # Check if it’s a stress intensity factor result
result.Activate()
# Get the table for stress intensity factor (K1)
sif_table = result.Tables.FindObject(“Stress Intensity Factor K1”)
if sif_table is not None:
# Export the table data to a CSV file
fName = dpn + “_” + result.Name + “_” + analysis.Name + “_SIF.csv”
fPath = os.path.join(UserFilesDir, fName)
sif_table.ExportToCSV(fPath)
1. question: But there is no Excel in the user_file, so I don´t get the results. I don´t know how to get acces to the table with the solution for all the different contours. How can I get to the fracture tool and the SIFS(K1) with Python.
2. Before that, I tried what is explained here: https://developer.ansys.com/blog/script-tip-friday-python-code-object-mechanical, but ANSYS only export the picture of the current design point. So I need the Table Data for all the design points, not only the current one. Could you help me with that problem too?
Thank you so much for your help. Solving this problem would save me so much time.
Best regards and thank you for your time again,
Elena -
November 13, 2023 at 4:06 pmRohith PatchigollaAnsys Employee
Hello Elena,
Please test your script first in the mechanical scripting console to make sure sif_table is correctly extracted before writing it out to the csv file.
From my understanding, these two lines are incorrect. Please check. For example, SIFResult Data Model Object Category doesn't exist.
if result.DataModelObjectCategory == DataModelObjectCategory.SIFResult: # Check if it’s a stress intensity factor result
sif_table = result.Tables.FindObject(“Stress Intensity Factor K1”)Please let me know what was the source of the above lines to check if I am missing something.
Best regards,
Rohith
-
November 14, 2023 at 10:33 amElena MaierSubscriber
Hey Rohith,
thank you so much for your answer and sorry that I didn´t try to script in the mechanical scripting before try it in the python extension.
Now I tried to run it in the mechanical scripting before. I have different problems:
1. I don´t know how to export a table instead of the pictures in ANSYS (because I want to export all the results of the stress intesity factor).
2. Which ObjectCategory is used for the StressIntensityFactors? (I can´t find it and also the things that mechanical scripting suggest are not the result I am searching for, thats what I tried to do with this lines:if result.DataModelObjectCategory == DataModelObjectCategory.SIFResult: # Check if it’s a stress intensity factor result
sif_table = result.Tables.FindObject(“Stress Intensity Factor K1”), I tried to get access to the fracture tool)
3. Only the data for the current DesignPoint is exported and the others aren´t.
4. If I run the mechanical script with the original code from the website, nothing happens.
I know this is a big question, and probably the forum is not the right place for it, but I don´t know where else to ask, since I can´t find any information about it. Normally I am not using the mechanical scripting function and use the graphical user interface, that´s why I have so many questions. Sorry for that.
It would be great, if you could help me, because it seems that there is no other way to export data automatically from different design points in any other way.
Best regards,
Elena -
November 14, 2023 at 10:42 amRohith PatchigollaAnsys Employee
Hi Elena,
I understand. I would suggest opening a new post in ANSYS Developer forum as this is the place for scripting related questions.
https://discuss.ansys.com/
Also, please check the existing discussions, perhaps, a similar query might already have been answered.
For checking DataModelObjectCategory, you can activate a particular object in the Mechanical Tree and type the below commands.
activeObj = Tree.FirstActiveObject
activeObj.DataModelObjectCategory
Best regards,
Rohith
-
- The topic ‘Design point reslut export’ is closed to new replies.
- Problem with access to session files
- Ayuda con Error: “Unable to access the source: EngineeringData”
- At least one body has been found to have only 1 element in at least 2 directions
- Error when opening saved Workbench project
- Geometric stiffness matrix for solid elements
- How to select the interface delamination surface of a laminate?
- How to apply Compression-only Support?
- Timestep range set for animation export
- Image to file in Mechanical is bugged and does not show text
- SMART crack under fatigue conditions, different crack sizes can’t growth
-
1191
-
513
-
488
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.