How to get all Component or Named Selection Names from an MAPDL results file: DPF

Mike.Thompson
Mike.Thompson Member, Employee Posts: 327
25 Answers First Anniversary 100 Comments 25 Likes
✭✭✭✭

How can I get a list of the components defined in the results file through DPF in Mechanical?

Tagged:

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 859
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭
    Answer ✓
    import mech_dpf
    import Ans.DataProcessing as dpf
    mech_dpf.setExtAPI(ExtAPI)
    #Get path to result file
    analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
    filepath = analysis.ResultFileName
    #Data sources
    dataSources = dpf.DataSources()
    dataSources.SetResultFilePath(filepath)
    # Model
    model=dpf.Model(dataSources)
    print(model.AvailableNamedSelections)