Named Selections in Ansys Mechanical are a convenient way to group geometry or FEM entities for future use in model definition, i.e., mesh controls, material assignment, contact definition, etc., or post-processing. In a previous article, we discussed manual creation of Named Selections using geometry selection or via a Worksheet. Here, we will explain how to create Named Selections for all geometry bodies using Python scripting from within Ansys Mechanical.
The example model that we will here has model geometry composed of one single-body part and one multi-body part composed of four solid bodies. Our goal is to create a Named Selection for each of the five bodies as well as for the entire multi-body part so that we may use them in the scoping of model entities.
Additionally, we would like that our newly created Named Selections meet the criteria that are required for them to be sent to the APDL solver, namely
Finally, we would like to place the auto-generated Named Selections in a Tree Grouping folder that can referenced in other scripts, for example, to automatically create Equivalent Stress results for post-processing.
The anatomy of the automation script consists of generating and manipulating the following entities:
The end result of running the script is shown in the figure below.
Here, we have a combination of the auto-generated Named Selections by script as well as some manually created ones that don't lend themselves to creation by automation.
In conclusion, the method to auto generate Named Selections by script has many applications most notably when the number of Parts in the Geometry branch is large enough to make manual creation of Named Selections tedious. Additionally, placing the auto-generated Named Selections in a Tree Grouping folder allows for direct access in subsequent scripts. Finally, it is best to automate repetitive tasks when possible so that one's workflow can be spent on value added activities. Using a script such as the one presented here makes repetitive tasks less time consuming.
Script to create Named Selections - open in the Mechanical Scripting window under the Automation tab in Ansys Mechanical.
Blog: Using Named Selections in Ansys Mechanical