Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Using python to extract element labels/connectivity from odb element set

Status
Not open for further replies.

icantdrive55

Mechanical
May 1, 2013
2
Hello,

New to this forum but not to ABAQUS. I am in the very early stages of learning python and am attempting to write a script that will read and print the element labels (and eventually the connectivity) for a specified element set (EPOWER) from an odb. There is an example in the manuals similar to what I'm attempting, but I was unable to get it to work for my specific case. My python script is as follows:

---------------
from odbAccess import *
from abaqusConstants import *
from textRepr import *

import math
import sys, os
import numpy.oldnumeric as Numeric
import profile
from abaqusExceptions import excTyValStr

# Specify the odb filename (w/o .odb extension)
odb = openOdb('Job-1.odb')

ElemSetData = odb.rootAssembly.elementSets['EPOWER']

# Extract the connectivity for all elements in EPOWER
prettyPrint(ElemSetData.elements,3)

for iele in ElemSetData.elements:
print iele.label
---------------------------------

The error I get is:

AttributeError: 'OdbMeshElementArray' object has no attribute 'label'


The prettyPrint statement clearly shows that the attribute label is present. Any help with what is probably a rookie error would be appreciated.

Regards,

Scott

 
Replies continue below

Recommended for you

Because

>>> print ElemSetData.elements
(openOdb(r'D:/Nelson/example/example.odb').rootAssembly.elementSets['EPOWER'].elements[0],)

So try this

aux = ElemSetData.elements[0]
for iele in range(len(aux)):
print aux[iele].label


Hope it helps
 
nelson,

That was very helpful ... it works!

many thanks!

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor