How do I get mechdb path for each Mechanical Model in WB?
Ayush Kumar
Member, Moderator, Employee Posts: 444
✭✭✭✭
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:
0
Answers
-
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()))
0