Hey sboy and ob1.
It seems that its not that simlpe. Have you seen, that Maya names the shapes of an object by a special way? Its not always the same style:
If you create pCube1 the ShapeNode is pCubeShape1
If you THEN name it pergbvcejwb1 the ShapeNode would be pergbvcejwbShape1.
But if you name it jyhcbwl its just jyhcbwlShape. If you THEN put a number in the name: jyhcbwl4Shape.
Very strange I think. So unfortunately you can't go shure with that. But there must be a way to call the ShapeNode of an object...
Another thing: Why don't you use that special "for-in" loop for selection-arrays? :] its very useful!
And why don't make it a toggle?
$selected = ls -sl
;
for ($i in $selected)
$iShape = listRelatives -shapes $i
;
setAttr ($iShape[0]+".displayVertices") (!getAttr ($iShape[0]+".displayVertices")
);