Hello everyone,
I am currently trying to create a script that automatically generates a restart analysis after the calculation is finished.
I use the recording option in Mechanical to look up the names of the commands. The recording option is using Ids. I then rewrite them.
There are 2 options for creating a restart analysis in the Mechanical interface.
The first option is creating a new system.
The second one is creating an object in the tree.
I am running a long script in Workbench.
I'm having problems adding a restart analysis after the calculation.
I tried to duplicate the first system and add a restart object in the second system.
#definition of the first system
STATIC_STRUCTURAL = ExtAPI.DataModel.AnalysisByName("Static Structural")
#creating Static Structural 2
STATIC_STRUCTURAL_2 = STATIC_STRUCTURAL.Duplicate()
STATIC_STRUCTURAL_2 = ExtAPI.DataModel.AnalysisByName("Static Structural 2")
#creating a restart setup in Static Structural 2
RESTART_SETUP_2 = STATIC_STRUCTURAL_2.CreateLoadObject("RestartSetup","RestartAnalysis")
#creating restart controls in Static Structural 2/ Analysis Settings
ANALYSIS_SETTINGS_2 = STATIC_STRUCTURAL_2.Analyses[0].AnalysisSettings
ANALYSIS_SETTINGS_2.GenerateRestartPoints = RestartControlsType.Manual
ANALYSIS_SETTINGS_2.SaveAtLoadStep = RestartSaveAtLoadStep.Last
ANALYSIS_SETTINGS_2.RetainFilesAfterFullSolve = RestartRetainFilesType.Yes
ANALYSIS_SETTINGS_2.CombineRestartFiles = CombineRestartFilesType.Yes
But I have problems defining the "Restart from system" option (see picture).
The recording function uses weird Ids again and I don't know how to rewrite it...
data_model_object_167 = DataModel.GetUserObjectById(167)
temp_prop = data_model_object_167.Properties['RestartSys']
temp_prop.Value = r'24'
And I would like to generate around 50 systems automatically after 50 calculations...
Do you have any ideas?
Best regards
Dayana

