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!

*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

Python Scripting - for element info

Python Scripting - for element info

Python Scripting - for element info

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.


RE: Python Scripting - for element info

You obtain the material via the section object.

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

from model:

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

from odb:

import odbMaterial
import odbSection

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

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']

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

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

RE: Python Scripting - for element info


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.


RE: Python Scripting - for element info

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".


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! Already a Member? Login


eBook - The Future of Product Development is Here
Looking to make the design and manufacturing of your products more agile? For engineering and manufacturing organizations, the need for digital transformation of product development processes just became more urgent than ever so we wanted to share an eBook that will help you build a practical roadmap for your journey. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close