Example Usage

The following example can be used as a basis of either the solve or evaluate script.

def runClassDemo_DesignAssessment():
    DA = DesignAssessment #just to save typing.
    #To know full details of deprecated functions.
    DA.OutputDeprecatedWarnings(True)

    #Get the helper object
    HelperObject = DA.Helper 
    #Output units string, e.g. MKS
    print DA.Units 
    # Get the MeshData object
    MeshDataObject = DA.MeshData
    print DA.ProjectTitle

    #Attribute Groups:
    #Obtain an array of all attribute group objects.
    AllAttributeGroupsObjects = DA.AttributeGroups() 
    #Filter for  an array of attribute group objects called Bob
    NameFilterAttributeGroupsObject = DA.AttributeGroups("Bob") 
    #Filter for an array of attribute groups with type Sam, subtype Phil
    TypeFilterAttributeGroupsObject = DA.AttributeGroups("Sam", "Phil") 
    #Returns the total number of attribute groups    
    print str(DA.AttributeGroupCount) 
    
    #Solution Selection:
    #Obtain all solution selection objects
    AllSolutionSelections = DA.SolutionSelections()
    
    #DA Results:
    #Obtain an array of all DA Result objects.
    AllDAResultsObjects = DA.DAResults() 
    #Filter for an array of DA Result objects called John
    NameFilterDAResultsObject = DA.DAResults("John") 
    #Filter for an array of DA Result with with type Paul, subtype Mike
    TypeFilterDAResultsObject = DA.DAResults("Paul", "Mike") 
    #Returns the total number of DA Result objects
    print str(DA.DAResultCount)
    
    #Access first object in NameFilterAttributeGroupsObject array
    if (NameFilterAttributeGroupsObject != None):
        AGObjectA = NameFilterAttributeGroupsObject[0] 
    
    #Example Loop around Array AllAttributeGroupsObjects
    for AGObject in AllAttributeGroupsObjects:
        #Now AGObject is a representation of each Attribute Group.
        print AGObject.TreeName
runClassDemo_DesignAssessment()

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