Example Usage

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

def runClassDemo_SolutionResult():
    #Create a scripted, user defined, result
    MyRes = DesignAssessment.SolutionSelections()[0].SolutionByRow(1).CreateSolutionResult()
    
    #Define what result we're obtaining.
    MyRes.Expression = "UX"
    
    #You can specify the solution or Global system..
    MyRes.CoordinateSystem = "Solution"
    #Alternatively, define a coordinate system directly.  
    #The last CS defined takes precidence.
    #MyRes.DefineCoordinateSystem("ZX",1,0,0,0,1,0,0,0,0)
    
    #Define the units sytem and the units type to convert the results.
    #MyRes.SetUnitsSystem("UMKS","Radians","Celsius","Distance")
    
    #Define the method of integrating the results, this can affect the result type.
    #MyRes.IntegrationMethod = "UnAveraged"
    
    #Set the time or set for the results that we want to obtain, 
    #last one defined takes precidence.
    MyRes.ResultSet = 0
    MyRes.ResultTimeFrequency = 0
    
    #Get some info about this result
    DS = MyRes.DisplayStyle
    print DS
    DT = MyRes.DisplayType
    print DT
    NC = MyRes.ComponentCount
    print NC
    NRS = MyRes.ResultSetCount
    print NRS
    
    #Loop around all elements objects.
    for ElementIter in DesignAssessment.MeshData.Elements():
        print "Element Values = " + str(MyRes.ElementalValues(ElementIter.Id))
        for NodeIter in ElementIter.Nodes():
            Values = str(MyRes.ElementNodalValues(ElementIter.Id,NodeIter.Id))
            print "Element Nodal Result Values = " + Values

    #Loop around all node objects.
    for NodeIterator in DesignAssessment.MeshData.Nodes():
        print "Node Result Values = " + str(MyRes.NodalValues(NodeIterator.Id))
runClassDemo_Solution()

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