Restart Analysis in Mechanical
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
Comments
-
@Rohith Patchigolla Would you be able to help here? Thank you :-)
0 -
Hi @Pernelle Marone-Hitz and @dayana_behrens , apologies for the delay in my reply.
I missed answering this question. Hope I am not too late.To answer your query, the property "RestartSys" will take Object Id of the Base analysis as an input.
Here is an updated script. Hope this helps.
#definition of the first system STATIC_STRUCTURAL = ExtAPI.DataModel.AnalysisByName("Static Structural") STATIC_STRUCTURAL_ObjectID = STATIC_STRUCTURAL.ObjectId #creating Static Structural 2 STATIC_STRUCTURAL_2 = STATIC_STRUCTURAL.Duplicate() STATIC_STRUCTURAL_2 = ExtAPI.DataModel.AnalysisByName("Static Structural 2") ANALYSIS_SETTINGS_2 = STATIC_STRUCTURAL_2.AnalysisSettings ANALYSIS_SETTINGS_2.NumberOfSteps += 1 ANALYSIS_SETTINGS_2.GenerateRestartPoints = RestartControlsType.Manual ANALYSIS_SETTINGS_2.SaveAtLoadStep = RestartSaveAtLoadStep.Last ANALYSIS_SETTINGS_2.RetainFilesAfterFullSolve = RestartRetainFilesType.Yes ANALYSIS_SETTINGS_2.CombineRestartFiles = CombineRestartFilesType.Yes #creating a restart setup in Static Structural 2 RESTART_SETUP_2 = STATIC_STRUCTURAL_2.CreateLoadObject("RestartSetup","RestartAnalysis") RESTART_SETUP_2.Properties[0].Value = STATIC_STRUCTURAL_ObjectID
0 -
Hello,
this works! Thank you very much
Best regards
Dayana2