How to work with .csv data in Mechanical: Export, Import and plot

Mike.Thompson
Mike.Thompson Member, Employee Posts: 367
25 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭

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:

  1. Automatically export displacements to a .csv file on solve
  2. Import from a .csv file to create a displacement condition for each node on a face
  3. 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

  • jackson
    jackson Member Posts: 3
    First Comment
    **

    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.
    jackson

  • jackson
    jackson Member Posts: 3
    First Comment
    **

    Hi Mike,
    Looking forward to hearing from you.
    Best regards.
    jackson

  • jackson
    jackson Member Posts: 3
    First Comment
    **

    Hi Mike,
    I should have solved both problems for now, thanks for sharing.
    Best regards.
    jackson