Hi, You actually have everything you need right there in the example, but I don't think you realized it. The call to pm.polyCube() returns a two item list: [<nt.Transform>, <nt.PolyCube>] What you are appending is both the transform, and the shape node. If you don't care about the shape node, you could just ignore that return value, and only append the transform. Then you have what you need, and there is no reason for a selection operation.
import pymel.core as pm MyCubes = []; for i in xrange(10): tx, _ = pm.polyCube( n='TestCube') MyCubes.append(tx) print MyCubes # [nt.Transform(u'TestCube'), nt.Transform(u'TestCube1'), ... ] Also, you don't need the semi-colon at the end of lines. Thats a mel thing. Python doesn't care, unless you are doing multiple operations on a single line: x = 1; y = 2; z = 3 On Thu, May 31, 2012 at 12:54 PM, Vladi <[email protected]> wrote: > hi i just started using pymel, and i would like to store all the > transform classes of the created cubes in a separate list. > > right now i have : > > MyCubes = []; > > for i in range(10) : > MyCubes.append(pm.polyCube( n='TestCube')); > > then i have to select the cubes in the scene to get the transform > classes : > > MyCubes_transform = pm.ls( selection = True); > > > Im shure there is a better way... > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
