-
-
April 7, 2024 at 11:18 am
Bob
SubscriberI 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 pm
Aniket
Forum ModeratorLOCX will always give the original X coordinate.
LOC_DEFX will be deformed location X coordinate.
-Aniket
-
April 10, 2024 at 9:28 am
Bob
SubscriberThank you for your advice
-
- The topic ‘Export global coordinates of all nodes using workbench script’ is closed to new replies.
-
3367
-
1050
-
1047
-
886
-
837
© 2025 Copyright ANSYS, Inc. All rights reserved.