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


Element selection by python script - Abaqus

Element selection by python script - Abaqus

Element selection by python script - Abaqus

Hello all,

I am having trouble selecting elements from Abaqus using python script, it needs to be adaptable to varying mesh size and varying sample length/area.

I am trying to generalize part of script for element selection in pre-processing and using the element sets for use in post processing. I have searched and thought that I got the solution using one of the other questions, but I having a different error. I ran this for a 2D model in Abaqus PDE 2017 version.

I have read these questions :
1. Selecting multiple partitioned regions in ABAQUS with findAt for setting mesh controls
2. Abaqus: script to select elements on a surface
3. Selecting elements in Mesh Part (Orphan Mesh)

I am also attaching my code

CODE --> python


a = mdb.models['xxxxxx'].rootAssembly

RP_Cent = a.ReferencePoint(point=(length-th+crack+crack_offset,2*height1+height2,0))
a.features.changeKey(fromName='RP-1', toName='RP_Cent')
RP_Left = a.ReferencePoint(point=(length-th+crack+crack_offset-dms/2,2*height1+height2,0))
a.features.changeKey(fromName='RP-1', toName='RP_L')
RP_Right = a.ReferencePoint(point=(length-th+crack+crack_offset+dms/2,2*height1+height2,0))
a.features.changeKey(fromName='RP-1', toName='RP_R')

e1 = a.instances['Upper_Adh'].elements
Cent = e1.getByBoundingBox(length-th+crack+crack_offset-dms/2, 2*height1+height2-ElemSize, 0, 
                           length-th+crack+crack_offset+dms/2, 2*height1+height2, 0) 
a.Set(elements=Cent, name='Centroid_Elements') 

The reference points are getting generated so the co-ordinates are not wrong.

I had expected the created set to be of element type and have 10 elements, however the set created is of geometry type and ofcourse has no elements. Error Screenshot. Please suggest a correction to my code or a better approach.

All help is appreciated.

RE: Element selection by python script - Abaqus

Make a simple example, adopt the script to that (as good as possible) and attach the .cae file and the script here. Then I can run it, see what happens and suggest something.

RE: Element selection by python script - Abaqus

Hi @Mustaine3,
I am so happy that you responded. Have read too many of your replies.

Quote (Mustaine3)

Make a simple example, adopt the script to that (as good as possible) and attach the .cae file and the script here. Then I can run it, see what happens and suggest something.

As per your suggestion I was making a fresh model to upload here, but it so happened that the code generated element sets for both 2D and 3D parts the way I wanted them to. However the same code is not working in existing models. Could you somehow explain why.

Also could you let me know how to read / extract a particular reference point's x,y,z co-ordinates for use in python code, without having to use the query function.

Abhishek M

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


White Paper - The Evolving Landscape of Commercial Battery-Powered Trucks
What’s driving the evolving landscape of truck electrification? What are the barriers, motivators and strategies for accelerating the electric transition? What insights and resources are available for today’s design engineers working to achieve industry disruption and evolution? For answers to these and other pertinent questions, read this white paper. Download Now
eBook - Rethink Your PLM
A lot has changed since the 90s. You don't surf the Web using dial-up anymore, so why are you still using a legacy PLM solution that's blocking your ability to innovate? To develop and launch products today, you need a flexible, cloud-based PLM, not a solution that's stuck in the past. 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