How to plot directional deformation with vectors?
Javier Vique
Member, Employee Posts: 84
✭✭✭✭
in Structures
In Mechanical, we can plot the total deformation as vector. However, there is no way to plot a directional deformation. This is reasonable, since a directional deformation is just a scalar value. However, an user might be interested to have a plot of that directional deformation with vectors which are proportionals to their values. How to do it?
Tagged:
0
Answers
-
This can be easily done using Python Result object. The directional deformation is read using dpf and then a custom field is created, applying zero value to the deformation on the other two directions. Please see below script done for deformation on z direction.
If the deformation must be plot on a specific CS, please see this post.def define_dpf_workflow(analysis): import mech_dpf import Ans.DataProcessing as dpf mech_dpf.setExtAPI(ExtAPI) dataSource = dpf.DataSources(analysis.ResultFileName) scoping_refs = this.GetCustomPropertyByPath("Surface UZ/Scoping Property/Geometry Selection").Value nodes_loc = mech_dpf.GetNodeScopingByRefId(scoping_refs) uz = dpf.operators.result.displacement_Z() uz.inputs.data_sources.Connect(dataSource) uz.inputs.mesh_scoping.Connect(nodes_loc) num_nodes = nodes_loc.Count disp_vector = dpf.FieldsFactory.Create3DVectorField(numEntities = num_nodes) k = 0 for i in uz.outputs.fields_container.GetData()[0].ScopingIds: datak = uz.outputs.fields_container.GetData()[0].Data[k] k = k + 1 disp_vector.Add(id=i,data=[0.0,0.0,datak]) output = dpf.operators.utility.forward() output.inputs.any.Connect(disp_vector) dpf_workflow = dpf.Workflow() dpf_workflow.Add(output) dpf_workflow.SetOutputContour(output) dpf_workflow.Record('wf_id', False) this.WorkflowId = dpf_workflow.GetRecordedId()
The result would be like this:
0