Max Occurs On

This script finds the body on which Maximum Occurs On. Select the result object and run the script!

Transparent Transparent

After you run the script the body gets activated:

Transparent Transparent

myres = Tree.FirstActiveObject
vals=list(myres.PlotData["Values"])
maximum = max(vals)
mesh_data = ExtAPI.DataModel.Project.Model.Analyses[0].MeshData
bodies = DataModel.GetObjectsByType(DataModelObjectCategory.Body)
try:
    maxplace = myres.PlotData["Node"][vals.index(maximum)]
    for body in bodies:
        geobody = body.GetGeoBody()
        mesh_for_body = mesh_data.MeshRegionById(geobody.Id)
        if maxplace in mesh_for_body.NodeIds:
            print('Node ' + str(maxplace) + ' is in body named: ' + str(body.Name))
            break
except:
    maxplace = myres.PlotData["Element"][vals.index(maximum)]
    for body in bodies:
        geobody = body.GetGeoBody()
        mesh_for_body = mesh_data.MeshRegionById(geobody.Id)
        if maxplace in mesh_for_body.ElementIds:
            print('Element ' + str(maxplace) + ' is in body named: ' + str(body.Name))
            break
body.Activate()