0

如果单元格体积小于给定值,我正在尝试编写一个脚本来删除 ABAQUS 中某个部分的单元格。是否有删除单元格的简单命令?

这是我尝试过的:

# 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'

谢谢!

4

1 回答 1

0

这个怎么样,假设pInter是一个 Part 对象:

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

更新:一旦两个单元格的公共面被删除,两个单元格将不复存在。因此,我们需要做一些解决方法:

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])
于 2016-08-09T11:37:13.557 回答