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))
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
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