Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

found MeshElement, expecting Tuple

Status
Not open for further replies.

PeterP1

Materials
Mar 27, 2009
9
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, name='Element'+str(i))
 
Replies continue below

Recommended for you

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",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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor