One of the most common operations and sometimes the hardest to automate in our Python scripts is the selection of geometry. This task is essential to assign material properties, define boundary conditions, control mesh settings, create interactions, etc. I want to bring you the 5 ways to select geometry in Abaqus using Python commands.
You may be asking, why?
Because the default method recorded by Abaqus is based on masks, but it has several drawbacks: is not reliable when geometry changes and is not intuitive at all.
So, let’s see a few methods to automate the selection of geometry using Python in Abaqus.
1. The 5 ways to select geometry with Python
The five strategies to select geometry in Abaqus (vertices, edges, faces and cells) using Python commands are:
#1 Masks
This is the default syntax used by Abaqus to record the selection of geometry through Python commands (getSequenceFromMask). It might be enough for geometries that do not change, but it is useless if the geometry changes.
#3 Functions "getByBounding..."
This group of commands has 3 flavours: getByBoundigBox, getByBoundingCylinder and getByBoundingSphere. They return the geometrical objects contained into the box-cylinder or sphere defined by the arguments.
#4 Boolean operations
Boolean operations (union, difference and intersection) are supported among sets, both at the part and the assembly levels. In essence, the Python function does not return geometry, but it creates a new set (setByBoolean).
#5 Direct selection of geometry
We can filter geometry features individually based on one or multiple conditions. You can read this other blog post on how to get information from the geometry using Python.
Some of these 5 ways to select geometry in Abaqus using Python scripts are also applicable to mesh selections, such as masks, findAt, getByBounding functions and direct selection.
2. Testing selection of geometry in Abaqus scripting
In the following video you will see a practical demonstration on how to apply these 5 strategies in Abaqus using Python scripts.
I hope that you find these tips useful!