How do I get mechdb path for each Mechanical Model in WB?

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 416
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
edited June 2023 in Structures

How do I get **mechdb **path for each Mechanical Model in WB Console? Ideally a mapping of each Mechanical model to its respective **mechdb **file.

Tagged:

Answers

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 416
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Answer ✓
    Options

    This code will give you a dictionary of all WB Mechanical systems mapped to their respective mechdbs.

    from collections import defaultdict
    all_systems = [system.ToString().Split(":")[-1] for system in GetAllSystems()]
    
    all_mech_dbs = defaultdict(list)
    for system_name in all_systems:
        all_mech_dbs[system_name].append(filter(lambda x: ("%s.mechdb" % system_name.Replace(" ", "-") == x.Split("\")[-1]), GetAllFiles()))