WorkingDir
Hello
What is the best way to get the WorkingDir?
In documentation I found:
1. straight-forward, but doesn't seem to work:
anWD=ExtAPI.DataModel.AnalysisById(0).WorkingDir
2. Work-around via name:
an1=ExtAPI.DataModel.AnalysisByName(ExtAPI.DataModel.AnalysisNames[0])
anWD=an1.WorkingDir
3. Work-around via children/parents:
solution=ExtAPI.DataModel.GetObjectsByName('Solution')[0]
analysis=solution.Parent
anWD=analysis.WorkingDir
Shouldn't there be a working straight-forward way?
Regards
Lorenz
Answers
-
The working directory is Analysis dependent. Once you know the Analysis, it is very straightforward to get the working directory of that Analysis:
Analysis.WorkingDir
So what you are really asking is, "What is the best way to get the analysis of interest?" In general, no one can answer that for you, because it is application specific. But based on your code samples, it seems you want to get the working directory of the first Analysis system or perhaps you want to assume that there is only one Analysis system. In either case, I recommend:Analysis0 = ExtAPI.DataModel.Project.Model.Analyses[0] WorkingDir0 = Analysis0.WorkingDir
FYI. Method 1 is not working because you are using the wrong ID:
AnalysisID = ExtAPI.DataModel.Project.Model.Analyses[0].ObjectId WorkingDir0 = ExtAPI.DataModel.AnalysisById(AnalysisID).WorkingDir
0 -
This question has been asked and answered here: https://discuss.ansys.com/discussion/comment/1921#Comment_1921
0 -
-
Thank you for reporting this issue. I will make sure that the Help documentation is updated appropriately. @Pierre Thieffry , I will reach out to discuss.
0 -
And thank you for clarifying the Project -> Model -> Analysis -> WorkingDir dependency
0