0

I am trying to write an script to remove cells in a part in ABAQUS if the cell volume is smaller than a given value. Is there a simple command to delete a cell?

This is what I have tried:

# Keeps cells bigger than a certain minimum value 'paramVol': paramVol=volCell/part_volume_r
cellsVolume = []
pfacesInter_clean = []
allCells = pInterName.cells
mask_r = pInter.cells.getMask();
cellobj_sequence_r = pInter.cells.getSequenceFromMask(mask=mask_r);
part_volume_r = pInterName.getVolume(cells=cellobj_sequence_r);
volume_sliver = 0
# get faces
for i in range(0, len(allCells)):
    volCell = allCells[i].getSize()
    cellsVolume.append(volCell)
    paramVol = volCell / part_volume_r
    print 'paramVol= '+str(paramVol)
    if paramVol < 0.01:
        print 'liver Volume'
        #session.viewports['Viewport: 1'].setColor(initialColor='#FF0000') #-->RED
        faces = allCells[i].getFaces()
        highlight(allCells[i].getFaces())
        #pfacesInter_clean = [x for i, x in enumerate(pfacesInter) if i not in faces]
        volume_sliver += volCell
    else:
        print 'Not an sliver Volume'

Thanks!

user3641829
  • 261
  • 2
  • 11

1 Answers1

0

How about this, assuming pInter is a Part object:

pInter.RemoveFaces(faceList=[pInter.faces[j] for j in pInter.cells[i].getFaces()])

Update: once the common face of two cells is deleted, both cells cease to exist. Therefore, we need to do a little workaround:

faces_preserved = # List of faces that belong to cells with 'big' volume.
for cell in pInter.cells:
    pInter.RemoveFaces(faceList=[face for face in pInter.faces if \
                                 face not in faces_preserved])
honey_badger
  • 472
  • 3
  • 10