Scope a Boundary Condition to a Named Selection

Goal: Use a macro to create a fixed support and then scope it to a named selection.

Code:

# Macro to demonstrate the ability to create a fixed support and then scope it to a Named Selection
#
ns = DataModel.GetObjectsByName("myFaces")
# make sure only 1 named selection was found
if (ns.Count != 1):
    print("A single Named Selection was not Found!")
else:

    # get the first analsysis and make sure it is structural
    analysis = DataModel.AnalysisList[0]

    if (analysis.PhysicsType != PhysicsType.Mechanical):
        print("The first analysis isn't structural")
    else:
        # Finally create a fixed support and scope it to the Named Selection
        mySupport = analysis.AddFixedSupport()
        mySupport.Location=ns[0]
        print("Done creating a Fixed Support and Scoping to a Named Selection")