Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Python Scripting - for element info 1

Status
Not open for further replies.

macroguy

Mechanical
Jan 31, 2006
9
0
0
US
For the ABAQUS Experts out there,

I have written a small pyhton script that loops through all the elements in the model and writes out the nodal coordinates & element connectivity for each element. However I am not able to get the material number assigned to each element.

What scripting commands should I be using to query for the material number associated with each element? I would really appreciate it if someone out there can let me know how to do this.

regards
BV
 
Replies continue below

Recommended for you

You obtain the material via the section object.

Thus, you need to extract the name of the section.

Then:
from model:

model=mdb.models['My model name']
section=model.sections['Section name']
material=model.materials[section.material]

from odb:

import odbMaterial
import odbSection


odb=session.odbs['my odb']
section=odb.sections['Section name']
material=odb.materials[section.material]

For the odb case you need to obtain first the section assignment object.

Each odbInstance in the assembly has a sequence of
section assignments:
instance=odb.rootAssembly.instances['my odbInstance']
assignments=instance.sectionAssignments

each section assignment has 2 attributes:
set_i=assignments.region -> an OdbSet object
section_i=assignments.section -> a Section object

the OdbSet has an array of elements which you can be iterated (i.e. set_i.elements)
 
xerf,

thanks for the insightful reply. I have few questions however.

1. I am not using the odb to get this information, all i am doing is using ABAQUS as a pre-processor to get my mesh information, which I am writing out to a seperate file and solve it uisng a coustom code. So, instead of using
" instance=odb.rootAssembly.instances['my odbInstance']"

can i use

"instance= mdb.models['my model'].rootAssembly.instances".

2. By using mdb instances, will there still be 2 attributes you described for each section assignment, and what should I be looking for instead of the 'odbSet'.

3. Fianlly, where can I find all this information? I have looked up the ABAQUS scripting documentation online and couldnt find what you told me. I would be grateful to you if you can point me to some extensive source I can look up before posting my questions online.

regards
BV

 
1.instance= mdb.models['my model'].rootAssembly.instances['instance name']

2.odbSet is an object (class) associated with the .odb output database file, therefore if you are using CAE only as pre-processor you do no need odbSet.

In ABAQUS Scripting Interface (ASI) there are two main classes:
(i) mdb storing the pre-processing info
(ii) odb storing the post-processing info

Any class having its name starting with "odb" relates to the output database and to an odb object.

If you are using CAE only as a pre-processor and you are not convenient with the architecture of the ABAQUS Scripting Interface (ASI), a simpler approach would be to write the input file and extract the information from the input file (.inp) which is a text file.

CAE->Job module->Job Manager ->Write input.

The input file should be very easy to parse (especially if you are using Python) and it is prety much self-explanatory.

3. For ABAQUS Scripting Interface I use only "Scripting Reference Manual". To become convenient with the ASI structure , I think, one should start with the "Scripting User's Manual".


 
Status
Not open for further replies.
Back
Top