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
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
>>> 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
That was very helpful ... it works!
many thanks!
Scott