TAGGED: python-scripting
-
-
September 12, 2025 at 2:43 pm
FS
SubscriberI have a transient thermal model which solves at a number of times steps, the number may vary from simulation conditions. The results at each time step are stored in a solution folder.
For postprocessing I want to export the (in this case) temperature at each time step. I have created the following script. However it requires to enter the number of children manually. How can I determine the number of children, such as to remain the script untouched independent of the solution. BTW:r1.Children
does not work.
Script:
'''
Export all children in solution folder 'Temperature'
'''
import os
analysis=ExtAPI.DataModel.Project.Model.Analyses[0]
locationToExport = analysis.WorkingDir
# Enter number time steps
nsteps = 20
steps = list(range(2,nsteps+2))
for i in steps:
  resultsName = 'Temperature '+ str(i)
  fileName = resultsName + '.txt'
  fileToExport = os.path.join(locationToExport,fileName)
  r1=ExtAPI.DataModel.GetObjectsByName(resultsName)[0]
  r1.ExportToTextFile(fileToExport)
-
Viewing 0 reply threads
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
- The legend values are not changing.
- LPBF Simulation of dissimilar materials in ANSYS mechanical (Thermal Transient)
- APDL, memory, solid
- Convergence error in modal analysis
- How to model a bimodular material in Mechanical
- Meaning of the error
- Simulate a fan on the end of shaft
- Real Life Example of a non-symmetric eigenvalue problem
- Nonlinear load cases combinations
- How can the results of Pressures and Motions for all elements be obtained?
Top Contributors
-
3862
-
1414
-
1220
-
1118
-
1015
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.