Export to CSV file
Python API
2
Posts
2
Posters
13
Views
2
Watching
-
I want to output the results of the EM simulation "EM U(t)" as a csv file, but I can't save it.
Please tell me the reason.Thank you in advance.
# Adding a new PlotViewer inputs = [em_sensor_extractor.Outputs["EM U(t)"]] plot_viewer = analysis.viewers.PlotViewer(inputs=inputs) plot_viewer.visible = True plot_viewer.ExportToCSV("C:/Temp/test.csv") plot_viewer.UpdateAttributes() document.AllAlgorithms.Add(plot_viewer)
-
you need to call plot_viewer.Update() before exporting to csv
the method returns False if you have not updated the viewer... (btw, I agree this is a bit unintuitive, the ExportCSV could do the update ...)
In general
- UpdateAttributes() just does a "meta-data" update, e.g. to initialize options
- Update() is the actual update call. It executes the main work of the filter, viewer, exporter, etc.