Eng-Tips is the largest forum for Engineering Professionals on the Internet.

Members share and learn making Eng-Tips Forums the best source of engineering information on the Internet!

  • Congratulations JStephen on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading material properties using Python?

Status
Not open for further replies.

DrBwts

Mechanical
Joined
Nov 4, 2012
Messages
297
Location
GB
OK my code so far...

Python:
mats=mdb.models['Job-15'].materials

for key in mats.keys():
    myElas=mdb.models['Job-15'].materials[key].elastic
    print myElas

My output...

({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((451.736, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((57532.1, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((69890.5, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((82248.9, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((94607.3, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((106966.0, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})
({'dependencies': 0, 'moduli': LONG_TERM, 'noCompression': OFF, 'noTension': OFF, 'table': ((119324.0, 0.3),), 'temperatureDependency': OFF, 'type': ISOTROPIC})

What I would like to do is to be able access just the contents of 'table' but the 'Elastic' objects aren't behaving like a dictionary or a tuple with a dictionary in it.

Any thoughts?
 
When you access the table then you'll get the properties as tuple.

Code:
mats=mdb.models['Model-1'].materials
for key in mats.keys():
    myElas=mats[key].elastic.table
    print myElas
 
Success thankyou!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top