How can I link Analysis System Index in Mechanical to it's corresponding System Index on the Project
How can I link Analysis System Index in Mechanical to it's corresponding System Index on the Project page?
For multiple systems / mechanical sessions of the project page the SYS- is incremented by 1 each time a system is created, based on the time is created. How do I get the SYS- and Analysis index mapping in Mechanical Session.
Answers
-
I don't think there is a direct link between the SYS- and Analysis index from an analysis in Mechanical, because SYS - IDs increment by 1 each time a system is created, SYS- are given to systems in the order of their creation time (SYS, SYS-1, SYS-2…), but the indexes start from zero for every Mechanical session (as shown in the screenshot). One can however, use the result file path to build a workaround.
The following code will give a dictionary -
SYSTEM_ANALYSIS_LINK_DICT
, which contains the mapping of SYS-ID with the analysis index.Note: Please change "file.rst" in the regex expression as per analysis type.
SYSTEM_ANALYSIS_LINK_DICT = {} import re my_regex_expression = r"(.*)\MECH\file.rst" for index, analysis in enumerate(ExtAPI.DataModel.AnalysisList): system_directory = re.search(my_regex_expression, analysis.Solution.ResultFilePath) system_string = system_directory.group(1).Split("\")[-1] SYSTEM_ANALYSIS_LINK_DICT.update({system_string: index})
0 -
You can as well get the WB system name like below
analysis1 = ExtAPI.DataModel.Project.Model.Analyses[0] WBSystemName = analysis1.WorkingDir.split("\")[-3]
0