-
-
April 7, 2024 at 11:18 amBobSubscriber
I am conducting a collision experiment of two objects using explicit dynamics.
I want to export the global coordinates of all nodes of object 1 at every step through the python script below.
(At this time, LOCX selected object number 1 and used the LOC expression of the user defined result.)- for step in range(steps): # steps
- time = aset.GetStepEndTime(step + 1)
- Â
- for obj in solution.Children:
- name = obj.Name
- if name == "LOCX1":
- obj.DisplayTime = time
- Â
- solution.EvaluateAllResults()
- Â
- X = DataModel.GetObjectsByName("LOCX1")[0].PlotData
- Â
- f = open(base_dir + "LOCX1_" + str(step + 1) + ".txt", mode="w")
- f.write("Unit : " + str(X['Values'].Unit) + "\n")
- for i in range(len(X['Node'])):
- node = X["Node"][i]
- # side = X["Shell Side"][i]
- val = X["Values"][i]
- f.write(str(node) + "," + str(val) + "\n")
- f.close()
However, when you run the post script, the same value is output as the step progresses, that is, over time, as shown below.
These values are the location values from the last step.And when checking the graph below, we confirmed that the value of LOCX does not change over time.
What user defined result expression should I use to output the global coordinates of all nodes according to the step?
For example, use 'UX+LOC_DEFX' as the user defined result expression.Â
p.s. I know that mechanical has the following export option. However, the option does not seem to be applied when outputting from a script.
-
April 8, 2024 at 1:48 pmAniketForum Moderator
LOCX will always give the original X coordinate.
LOC_DEFX will be deformed location X coordinate.
-Aniket
-
April 10, 2024 at 9:28 amBobSubscriber
Thank you for your advice
-
- The topic ‘Export global coordinates of all nodes using workbench script’ is closed to new replies.
- Problem with access to session files
- Ayuda con Error: “Unable to access the source: EngineeringData”
- At least one body has been found to have only 1 element in at least 2 directions
- Error when opening saved Workbench project
- Geometric stiffness matrix for solid elements
- How to apply Compression-only Support?
- How to select the interface delamination surface of a laminate?
- Timestep range set for animation export
- Image to file in Mechanical is bugged and does not show text
- SMART crack under fatigue conditions, different crack sizes can’t growth
-
1216
-
543
-
523
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.