Macro export transient FEM results

Description
This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.

Background
A transient analysis in FreeCAD ends up with a bunch of FEM result objects, one for each timestamp. The individual results can be investigated directly in FreeCAD and be post-processed using pipelines. However, the possibilities within FreeCAD are still limited, especially for transient analyses. A better tool for post-processing and visualisation is ParaView. You can export single FEM result objects from FreeCAD as a .vtk or .vtu file, which can then be opened with ParaView. Unfortunately, the FEM workbench doesn't support the export of multiple .vtk files at one time (yet). That's where this macro comes into play.

How to use (experienced users)
Run the macro on a FreeCAD project that includes several FEM result objects from a transient analysis. Besides the .FCStd file, a new folder 'vtk-export' will be created, containing the individual results (.vtu files), and a .pvu file that can be opened from ParaView.

How to use (step-by-step with example)
As an example, the bending of a aluminium/steel bimetal strip is used. A step-by-step guide to create the sample file is given here, or you can download the file in the download section on this page.

With the example file opened, we go to Macro > Macros..., select "ExportTransientResults_190830.FCMacro" (or whatever name you saved it as) and execute it. The macro will now create a subfolder 'vtk-export' besides the .FCStd file. Depending on the number and size of the result objects, this may take some time. In the Report View (View > Report View), we should see 'Macro finished', if eveything went fine - or some error messages. (Note: Sometimes messages like 'PropertyFloatList NOT exported to vtk' appear, but I was able to work with the VTK files anyway...) In the subfolder 'vtk-export', we will find .vtu files, one for each result set for each timestamp. Additionally, a .pvd file is created, which tells ParaView which result set belongs to which timestamp.

Now, we open ParaView and go to File > Open... and open the .pvd file. In the 'Properties' tab, we click 'Apply' to load the results. In the 'Information' tab we will see a list of Index and Value, corresponding to the timestamps of the results that we just imported. (Of course, it always makes sense to check if the times given here are correct or if something strange happened during the export.) From here, we can use ParaView to play around with the results. Since ParaView offers a lot of possibilities, please refer to the appropriate documentations around the internet.

[developing...]

Downloads

 * The macro file: Link title
 * The example file without result objects: Link title
 * The example file with result objects: Link title