How can I programmatically export ANSYS optiSLang plot data into a CSV files?
ANSYS optiSLang postprocessing scripting API can be used to automate optiSLang's postprocessing.
Using the following script will extract all response data points and their approximated values:
from py_monitoring_kernel import * from py_monitoring_gui import * residual_plot = Visuals.Residual( Id(Visuals.Residual.get_display_name()), data_id ) control_container.add_control( residual_plot, True, RELATIVE_POSITIONING, 1/2., 0, 1/2., 1/2., Visuals.Residual.get_group_name() ) mon_data=controller.get_monitoring_data(data_id) response_names=mon_data.get_response_names() for response in response_names : Convenience.set_response_to_3rd_axis( controller, data_id, response ) control_container.flush() residual_plot.export_data( response + "_data.csv" ) #close pp after work is done ? control_container.close()
Script can be triggered from inside ANSYS optiSLang PostProcessing: or inside ANSYS optiSLang project: