Export to CSV file
-
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.
-
The problem has been resolved!
Thank you for your assistance!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login