×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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

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

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

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

(OP)
nelson,

That was very helpful ... it works!

many thanks!

Scott

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources