Result retrieval

Luiza
Luiza Member Posts: 7
First Comment Name Dropper
**
edited March 2023 in General Language Questions

Hi,

I am using the following code to retrieve elemental result for total current density in Ansys WB 2022R2 in a coupled field module.

Model=ExtAPI.DataModel.Project.Model

result=Model.Analyses[0].Solution.Children[1]

result.PlotData

Does anyone know how can i access the value for a specific (let's say the first one) element only?

I need the value for one element to do a comparison later in code. I tried the reader.getresult but it doesn't give the correct display option or result.

Thank you in advance!


Best Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 330
    25 Answers First Anniversary 100 Comments 25 Likes
    ✭✭✭✭
    edited March 2023 Answer ✓

    Something like this should work:

    ResultDict = {}
    for Id, Val in zip(result.PlotData["Element"], result.PlotData["Values"]):
        ResultDict[Id]=Val
    ResultDict[MyElemId]
    
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 330
    25 Answers First Anniversary 100 Comments 25 Likes
    ✭✭✭✭
    Answer ✓

    Or to simply get something by an index (this is NOT the element ID):

    result.PlotData["Values"][MyIndex]