Skip to main content

subtract element sets one from enother

Submitted by Liri_veny on

I'm trying to subtract a list of elements one of the other and I'm getting stuck.

I get my sets using the following code:

elemlist1=mdb.models['mesh_for_analysis'].parts['PART-1'].elements.getByBoundingBox(XMin,YMin,ZMin-delta,XMax,YMax,ZMin+delta)

mdb.models['mesh_for_analysis'].parts['PART-1']
.Set(elements=ElemList1, name='Zmin')

AllelemList= mdb.models['mesh_for_analysis'].parts['PART-1'].elements.getByBoundingBox(XMin,YMin,ZMin,XMax,YMax,ZMax) 

mdb.models['mesh_for_analysis'].parts['PART-1']
.Set(elements=
AllelemList
, name='all') 

now what I want to do is get the elements list that not in the ELemList1 but are in the AllelemList

and this is where I get stuck.

I tried the remove command:

NewList=AllelemList.remove(elemlist1)

and it didn't work.

I also tried 

 NewList=AllelemList-elemlist1

and it didn't work eather.

at the end I need to create a set that is a combination of all the elements in the newlist

please help

thanks