Notifications
Clear all
[Closed] loop through selection of elements/faces
Apr 26, 2006 2:10 pm
Hi!
I’m trying to loop through a selection of elements like
for i in selection do
does it with an selection of objects.
I selected some elements of my mesh inside a editable poly and now I would like to edit them via script. But I can’t find a way to loop through the elements. Is there something similar?
3 Replies
Apr 26, 2006 2:10 pm
Hi,
You can seperate the elements using polyOp.getElementsUsingFace fn and then loop through them.
Light
Apr 26, 2006 2:10 pm
Hi McM,
how did you go? This function will return an array of arrays holding the faces of an objects elements.
fn getelements obj=
(
try
(
f=obj.numfaces
eles=#()
done=#()
for i=1 to f do
(
if (finditem done i)==0 then
(
case (classof obj) of
(
editable_mesh:(faces=(meshop.getElementsUsingFace obj #(i)) as array)
editable_poly:(faces=(polyop.getElementsUsingFace obj #(i)) as array)
)
append eles faces
join done faces
)
)
)
catch(eles="non poly or mesh object!")
return eles
)
getelements selection[1]
Hope it’s useful!
J.