Skip to main content

Text List of Named Selections

PADT's script on writing out named selections to a text file in the ACT Console did not work for me when I copied-and-pasted it into the ACT console. Perhaps it was meant to be used with Linux OS? I tweaked the code a little for my Windows 10, Ansys WB 18.1. Here's my take:

a = ExtAPI.DataModel.AnalysisList[0]  #Get the first Analysis if multiple are present
workingdir = a.WorkingDir
path = workingdir.split("\\")

#Put the output file in the "user_files" directory for the project.
slashes = '\\'
userdir = slashes.join(path[:len(path)-4])+'\\user_files'

#Use the name of the system in case the snippet is
#used on multiple independent systems in the project.
system_name.replace(' ','_')
model = ExtAPI.DataModel.Project.Model
nsels = model.NamedSelections  #Get the list of Named Selections

if nsels:
    f = open("%s\\%s_named_selections_checked.txt"%(userdir,system_name), "w")
    for child in nsels.Children:

This and Other Related Posts
ACT Console: Link
Text List of Named Selection: Link

ACT to Automate Post-Processing: Link