Posts

Showing posts with the label Mechanical API

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=a.Name 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), ...

ACT Console

Image
The Humble Hammer Not being very handy around the house, I own a cheap  low cost hammer. But as any pro would tell you, no one uses a hammer for roofing. It is very inefficient and gives you a sore arm. We all want to avoid repeated stress-related injuries (physical and emotional). "Mouse Finger" injury is very real! To mitigate this, Ansys Mechanical has this really cool Automation API. Though intended for ACT debugging and creation, the ACT Console allows the user to input commands that is immediately reflected inside Mechanical. This functions like the Input Line in Ansys Classic! Unfortunately Mechanical only speaks Python and not APDL; so I'm just starting to learn a new language which is hard for an old guy like me. The potential benefits are enormous. Here are some examples: Say you do non-linear analysis 60% of the time and use the the same settings from a mental checklist. Now you could create Python script to automate those clicks.  If you have many t...