1

Good evening,

i have done a script for getting a model and to generate results. I've tried to write in the same script a way for getting to read the values of stresses but python says :

" File "C:/Users/TFG", line 250, in <module>     RegionTen=odb.rootAssembly.noseSets['Set-1']  KeyError: Set-1 "

I understand like Set-1 doesnt exit but that's not true. I hope someones can help me.

I create Set-1 :


mdb.models['Model-1'].parts['Part-1'].Set(faces= mdb.models['Model-1'].parts['Part-1'].faces.getSequenceFromMask(('[#1 ]', ), ), name='Set-1')

And my code for getting to read the stresses is:


odb = openOdb( path='C:\Temp\Job-1.odb')

RegionTen = odb.rootAssembly.nodeSets['Set-1']
tamFrames = len(odb.steps['Step-1'].frames)
lastFrames = odb.steps['Step-1'].frames[tamFrames-1]

stress33 = lastFrame.fieldOutputs['S'].getSubset(position=ELEMENT_NODAL,      region=RegionTen)
stress13 = lastFrame.fieldOutputs['CTSHR13'].getSubset(position=ELEMENT_NODAL,  region=RegionTen)
stress23 = lastFrame.fieldOutputs['CTSHR23'].getSubset(position=ELEMENT_NODAL, region=RegionTen)

print(stress11, stress22, stress12)

2 Answers2

2

You are now trying to get an assembly level node set. Yet, you are defining your node set inside a part. Inside the Odb, you need to access this node set through an instance.

Figure out the instance name from the part name. Most likely it's just 'PART-1-1'. After you do this, get the region like this:

regionTen = odb.rootAssembly.instances['instanceName'].nodeSets['Set-1']

You can see the difference between these set types in Abaqus. Instance level node sets have a prefix - 'InstanceName.'. Notice a dot after an instance name.

hgazibara
  • 1,832
  • 1
  • 19
  • 22
1

You can access the Node Sets defined in the Assembly using the following way:

odb.rootAssembly.nodeSets.keys()

And yes they seem to appear all in upper case.

arshovon
  • 13,270
  • 9
  • 51
  • 69
Yan
  • 11
  • 1