[S8352] Script to export the results of any case from multiple cases to a single CSV file

 

The following is an example of a script that writes the results of any case from multiple cases to a single CSV file.

app = designer.GetApplication()

# Get the results of the first case

ref1 = app.GetModel(0).GetStudy(0).GetDataSet(u"Torque",1)

# Creating graphs

graph = app.GetDataManager().CreateGraphModel(ref1)

# Add the results of the third and fifth cases to the graph you created.

ref2 = app.GetModel(0).GetStudy(0).GetDataSet(u"Torque",3)

graph.AddDataSet(ref2)

ref3 = app.GetModel(0).GetStudy(0).GetDataSet(u"Torque",5)

graph.AddDataSet(ref3)

# Export as CSV file

graph.WriteTable(u"D:/test.csv")

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.