Reputation: 15641
I created in Abaqus v6.14 scripting an extruded Part p
with BaseSolidExtrude
, which is then a cylinder (not necessarily circular). I want to create three sets, one for the top and bottom surface, and one for the lateral surface.
The first two are easy, with
faces = p.faces
face_bot = faces.findAt((p_center_bot,))
face_top = faces.findAt((p_center_top,))
p.Set(faces=face_bot, name='Set-face-bot')
p.Set(faces=face_top, name='Set-face-top')
But I couldn't find a way to create a Set
for the lateral face, even if for the time being, I have the advantage that these are the only 3 faces.
I tried extracting the indexes of face_bot
, face_top
with
face_bot_idx = face_bot[0].index
face_top_idx = face_top[0].index
(note that face_bot
and face_top
are of type Sequence
, having only one element each, so I extract element 0 in each case) and excluding them from the list of indexes of the 3 faces, so I get the index of my face_lat_0
with
# Of the 3 faces, get the one not being bottom or top
face_lat_idx = [idx for idx in range(len(faces)) if ((idx!=face_bot_idx) and (idx!=face_top_idx))][0]
But given that Face
object, I was unable to create the needed Sequence
face_lat
.
Note that the named argument faces
requires a Sequence
, and it seems not to accept a tuple
like (face_lat_0,)
or list
like [face_lat_0]
.
If I am correct that no list
or tuple
can be used, I need to create a Sequence
.
I found method getSequenceFromMask(...)
, but I don't know how to generate the mask for face_lat_0
, given its index.
Alternatively, I could try using named argument xFaces
, but I guess I would need a Sequence
containing face_bot[0]
and face_top[0]
to be excluded, which again I don't know how to build.
Any ideas?
Possibly related (although I didn't find the answer there):
Upvotes: 0
Views: 317
Reputation: 108
More straightforward option would be to use SetByBoolean(...)
. There is no need for intermediate sets since,
Note that if DIFFERENCE is specified, the order of the given input sets is important; All sets specified after the first one are subtracted from the first one.
faces = p.faces
face_bot = faces.findAt((p_center_bot,))
face_top = faces.findAt((p_center_top,))
Surf_face_all = p.Set(faces=faces, name='Set-face-all')
Surf_face_bot = p.Set(faces=face_bot, name='Set-face-bot')
Surf_face_top = p.Set(faces=face_top, name='Set-face-top')
# Create a lateral surface set by subtracting the top and bottom
p.SetByBoolean(name='Set_lateral_surface',
sets=(Surf_face_all, Surf_face_bot, Surf_face_bot),
operation=DIFFERENCE)
Upvotes: 0
Reputation: 924
You can make use of FaceArray
method from part
module which creates a sequence of faces. If the part is modified, then FaceArray
must be updated for that part.
Argument: faces
- A list of Face objects.
import part
# Get the one not being bottom or top
faces_list = []
for face_ in faces:
if (face_.index != face_bot_idx) or face_.index != face_top_idx):
faces_list.append(face_)
# Create a sequence of array from list of faces
face_seq = part.FaceArray(faces_list)
# Use that to create set
p.Set(faces=face_seq, name='Set-face-lat')
Upvotes: 0