I'm looking to create a plugin or script where the user can create a set of multiple faces and the plugin/script will then create sets for each of the faces. Ideally, the user would name the initial set (Set-1 for example) and the plugin would then name each created set with that original name and a suffix (Set-1-1, Set-1-2, ..., Set-1-n).
Sets would be created on shells and all faces will be rectangular. The sets can be defined at part or assembly level.
I have potentially thousands of sets to make. So would like to come up with something to streamline the process. However, I am not that experienced in using python.
I've looked in the .rpy file and it seems when you create a set of multiple faces Abaqus knows how many faces are selected, shown below. So I was wondering if you can use that? FromMask seems to be a GUI tool, which i've read is not very efficient. But I would be selecting the initial set in the GUI, so it seems unavoidable. Is there a way to get the faces out as a list and loop through the list creating individual sets?
p = mdb.models['Model-1'].parts['Part-1']
f = p.faces
faces = f.getSequenceFromMask(mask=('[#7f ]', ), )
p.Set(faces=faces, name='Set-1')
Currently using abq2023, so no python 3 ideally. Any help would be greatly appreciated. Thank you.
If I understand correctly, user will create a set using faces. And for each face in that set, you want to create a separate set.
YES. It is possible. The faces in a set can be accessed from the set object as:
# Face set name
faceSetName = 'Set-1'
# Access set object
faceSet_obj = mdb.models['Model-1'].parts['Part-1'].sets[faceSetName]
# Access the faces belong to set object
faceSet_faces = faceSet_obj.faces
Now, you just need to iterate over each face and create a set out it.
for i in range(len(faceSet_faces)):
# Get a single face in face array
face_obj = faceSet_faces[i:i+1]
# Create a set
setName = faceSetName + '-%d' % (i+1)
mdb.models['Model-1'].parts['Part-1'].Set(faces=face_obj, name=setName)