this is one of those things that way more cumbersome than it should be.
you need to create xydata :
session.xyDataListFromField(odb=odb,
outputPosition=ELEMENT_NODAL,
variable=(( 'S', INTEGRATION_POINT), ),
elementSets=('PART-1-1.SETNAME', ))
this creates a dictionary with objects for every node of every element and every stress component (ie. huge). Unfortunately the dictionary is keyed by cumbersome descriptor strings, eg:
session.xyDataObjects['S:S11 PI:PART-1-1 E: 15 N:2'].data
gives the 11 stress component of node 2 associated with element 15. To make use of the data in a script you need to either construct the strings, or loop over the dictionary and parse the positionDescription
for each object.
Edit: if you want the nodal averages its pretty much the same. You do:
session.xyDataListFromField(odb=odb,
outputPosition=NODAL,
variable=(( 'S', INTEGRATION_POINT), ),
nodeSets=('PART-1-1.SETNAME', ))
and the dictionary objects are keyed like:
session.xyDataObjects['S:S11 (Avg: 75%) PI:PART-1-1 N:2'].data
note you can issue multiple session.xyDataListFromField
calls and all of the data goes into xyDataObjects
(For example if you want stress and strain you can process both at once. )
For completeness, if you only want a specific component(s) you can request as:
variable=(( 'S', INTEGRATION_POINT,((COMPONENT, 'S11'),)), )