How to get the "analysis" from pre solve commands on a general ACT object

Options

Hello! I am currently working on an extension that uses a custom object in the Tree. The object is not a load object, but it does create apdl commands before the solve.

For some context the tree looks like this, where I create a custom folder, and then a custom object.

The custom Tree object then writes apdl commands using "getcommands" in the xml file.

Per the XML documentation the object will send the object, solver data, and stream so the apdl commands can be issued.

The issue I am having is that I need to determine the analysis that the object is writing the commands to. Normally for a load object you can access this by just using object.Analysis, but the general object does not have this as it is not located under an analysis in the tree.

Does anyone know of a way to determine what analysis the apdl commands are being written to for a general object? I checked the solver data and stream and I don't see a way to tie the commands back to the analysis that the commands are writing to.

Best Answer

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 208
    First Answer First Comment 5 Likes First Anniversary
    Answer ✓
    Options

    Here is one potential hack. Might need refinement if you are using remote solve.

    def issue_pre_solve_commands(load, inputData, stream):
        for analysis in ExtAPI.DataModel.AnalysisList:
            if '_ProjectScratch' in analysis.WorkingDir:
                current_analysis = analysis
        ExtAPI.Log.WriteMessage("current analysis: {}".format(current_analysis.Name))
    

    Another workaround is to create a load object in each analysis (in place of or in addition to the datamodel object).

Answers