How to work with .csv data in Mechanical: Export, Import and plot
There is often a need to work with data in a .csv format (comma delimited text file). You can store results, import conditions etc…
This attached analysis uses python code and results objects to:
- Automatically export displacements to a .csv file on solve
- Import from a .csv file to create a displacement condition for each node on a face
- Plot data directly from a .csv file onto nodes, allowing user to plot any arbitrary data on a given mesh.
The first analysis exports the data, while the second one imports it as a condition and plots it from a .csv directly. You will need to update the CSV file path selections in the import/plotting objects for your local paths after solving the first analysis.
Comments
-
Hi Mike,
I am very happy to see your sharing about displacement import and export operations. Currently in the process of running the file you shared, I have encountered two problems and would like to get your answers.
The first problem is shown in the picture below, there is a “?” on the left side of “write displacement to csv file”, how can I solve this? The second question is how do I know where the csv file exported from the first step of the analysis is located.
Thank you in advance.
Best regards.
jackson0 -
Hi Mike,
Looking forward to hearing from you.
Best regards.
jackson0 -
Hi Mike,
I should have solved both problems for now, thanks for sharing.
Best regards.
jackson0