×
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

found MeshElement, expecting Tuple

found MeshElement, expecting Tuple

found MeshElement, expecting Tuple

(OP)
Hello!

I'd like to assign each element on an edge to a set. It's quite easy to get access to the element objects and to adress each element object by the intenal labels. The problem is that for set definitions tupels are needed and not objects. Therefore, the following code leads to an error message: "found MeshElement, expecting Tuple"

Does anyone know a solution to this problem?   

c1=mdb.models['Model-1'].rootAssembly
c1.Set(elements=c1.sets['Edge'].elements, name='Elements')

for i in range(len(c1.sets['Elements'].elements)):
    c1.Set(elements=c1.sets['Edge'].elements[i], name='Element'+str(i))

RE: found MeshElement, expecting Tuple

(OP)
Just for clarification:

By the term "c1.Set(elements=c1.sets['Edge'].elements, name='Elements')" all the elements along the edge defined in the set "Edge" are assigned to the set "Elements".

What I want to do in the second part of the code is to assign each element on that edge individually to a set in order to get the sets "Element1", "Element2", "Element3",...
The term "c1.sets['Edge'].elements[i]",however, passes a  MeshElement Object and not a tuple.
In case I use "c1.sets['Edge'].elements[i:i+1]" a tuple is passed for the element i and everything looks fine. The problem is that the last element will cause an "Index out of Bounds Exception" because i+1 doesn't exist.

Does anyone know a solution or an alternative approach?

Thank you!
Peter
 

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