How to access the Discovery result and read the result value through script?

yuelei fu
yuelei fu Member, Employee Posts: 4
First Comment
✭✭✭

who can give me a example and teach me how to read the discovery result through the script, i can't find any demo or example to introduce.

Answers

  • Matthew Gargani
    Matthew Gargani Member, Employee Posts: 1
    First Anniversary Ansys Employee First Comment
    ✭✭✭

    Hello Yuelei Fu,

    If you have a monitor defined, you can get the value from a script using:

    MyMonitorValue = Results.Monitor.GetByLabel("A string that matches your Monitor's label, you'll have to change this text to match your simulation").GetValue()

    For example, with the built in Bracket_Static_Stress.DSCO file, typing:

    print(Results.Monitor.GetByLabel("Factor of Safety").GetValue())

    returns a value of 10.87

    Best Regards,

    Matthew

  • yuelei fu
    yuelei fu Member, Employee Posts: 4
    First Comment
    ✭✭✭

    Thank you Matthew, it's working.