How to get analysis data from a Model object?

Mateusz
Mateusz Member Posts: 19
10 Comments 5 Likes First Anniversary Name Dropper
**

Hi,
I have an object that simulates a specific kind of support. Currently this object only affects the current analysis it is being set to. I would like it to affect every analysis in the tree. I've managed to create a duplicate of it in XML, adding a <target type="userobject" name="analysisFolder"/> - so now I can add the "same" object to either Analysis or Model (they do have a different XML name, but the captions and functions are the same) - see picture below.

This object adds APDL commands to the solver using <getcommands>. For the global (Model) object if I try to get to the current analysis using load.Analysis, it returns None. How do I access the Analysis that is currently being solved? I need to get things like WorkingDir, MeshData, analysis unit system and more.

Best Answer

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 404
    100 Likes 25 Answers 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    There is an interface level Call Back for before solve. This callback provides the Analysis as a standard input. This isn’t a callback of the object, but the mechanical interface level.

    Create a global variable called active analysis and set that global variable value in the before solve Call Back. This makes it globally available for any subsequent methods writing to the input file.

Answers

  • Mateusz
    Mateusz Member Posts: 19
    10 Comments 5 Likes First Anniversary Name Dropper
    **

    Thanks Mike! That did the trick. It's the first time for me to use the interface-level callback. In case anyone wondered, here is a screenshot from the ACT help - OnBeforeSolve callback goes there.

    That also might be helpful for the other question I had before (https://discuss.ansys.com/discussion/comment/6225#Comment_6225), as result, load and object are missing an action that's called before solve. This OnBeforeSolve callback can act as a cleanup one.