3

I've created a Set of elements in the rootAssembly in an .mdb file:

a = mdb.models['Model-1'].rootAssembly
els_1 = a.instances['Part-1'].elements
Coh_els = els_1.getByBoundingBox(x1 y1 z1 x2 y2 z2) 
a.Set(elements=Coh_els, name='COHELSET-0')

I'm attempting to access field outputs in this element set in the .odb file:

coh_els = odb.rootAssembly.instances['PART-1'].elementSets['COHELSET-0']

But I get 'KeyError: COHELSET-0' (the element set is not visible in the .odb model tree) so I cannot access the field output in this set.

The rest of my code works when I use an element set that is visible in the tree so I know the problem is in accessing the pre-defined element set.

Could somebody please explain to me what I'm doing wrong?

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Masha
  • 41
  • 1
  • 3

1 Answers1

1

The problem was fixed by changing the line

coh_els = odb.rootAssembly.instances['PART-1'].elementSets['COHELSET-0']

to

coh_els = odb.rootAssembly.elementSets['COHELSET-0']
Masha
  • 41
  • 1
  • 3