In Mechanical, how to export animation file over a range of result sets instead of all result sets?
Mechanical doesn't have an option to choose a specific result set range to export animation and always exports the complete time history as an animation file. Eg: I have 10 result sets, but I want to export animation only for result set 1-3.
Comments
-
One can use Python Result object in Mechanical to specify the result sets and then export the animation from this object.
Step 1: In Mechanical, add a Python Result object. This should by default plot Total Deformation at last result set.
Step 2: Modify the Python Result object according to the result you need (Modify - Operators etc). In this example, for simplicity, I am omitting this step.
Step 3: Paste the below script in your python result object.
def post_started(sender, analysis):# Do not edit this line define_dpf_workflow(analysis) # Uncomment this function to enable retrieving results from the table/chart def table_retrieve_result(value):# Do not edit this line import mech_dpf import Ans.DataProcessing as dpf wf = dpf.Workflow(this.WorkflowId) wf.Connect('contour_selector', value) this.Evaluate() def define_dpf_workflow(analysis): import mech_dpf import Ans.DataProcessing as dpf mech_dpf.setExtAPI(ExtAPI) dataSource = dpf.DataSources(analysis.ResultFileName) u = dpf.operators.result.displacement() nrm = dpf.operators.math.norm_fc() timeScop = dpf.Scoping() #Specify the result sets that are needed to be extracted timeScop.Ids = [1,2,3] u.inputs.time_scoping.Connect(timeScop) u.inputs.data_sources.Connect(dataSource) nrm.Connect(u) dpf_workflow = dpf.Workflow() dpf_workflow.Add(u) dpf_workflow.Add(nrm) dpf_workflow.SetInputName(u, 0, 'time') dpf_workflow.Connect('time', timeScop) dpf_workflow.SetOutputContour(nrm) dpf_workflow.SetOutputWarpField(u) dpf_workflow.Record('wf_id', False) this.WorkflowId = dpf_workflow.GetRecordedId()
Step 4: RMB on Python Result object --> Connect. Evaluate All Results and animate the results as usual for this Python result object and export the animation.
3