Work with Solution Combinations

Goal: Create a solution combination object combining two environments.

Code:

# create a solution combination object combining 2 environments
sc = ExtAPI.DataModel.Project.Model.AddSolutionCombination()

# get the environments, an alternative would be via ExtAPI.DataModel.Project.Model.Analyses
envs = ExtAPI.DataModel.Tree.GetObjectsByType(DataModelObjectCategory.Analysis)

ws = sc.Worksheet
ws.AddRow()
ws.SetCoefficient(0,1.234)
ws.SetEnvironmentId(0, envs[0].ObjectId)
ws.SetTime(0,1)

if envs.Count < 2:
    print "There are not 2 or more environments"
else:
    ws.AddRow()
    ws.SetCoefficient(1,2)
    ws.SetEnvironmentId(1, envs[1].ObjectId)

Release 18.2 - © ANSYS, Inc. All rights reserved.