Adding attributes to sets in maya…

So got a couple of queries on how you actually add attributes to sets in practice.

When cgm.setTools creates a set with selected channel box attributes on the fly, there are a couple of processes going on.

  1. A set is created
  2. The channel boxes are queried for selection via the function
  3. There’s an active selection query for regular objects
  4. Objects and selected attributes are added to that set

Sometimes you just wanna do stuff  yourself so here’s a few examples. Here’s an example of adding an attribute to an existing set. So in this case, the existing set is ‘point_lightSet’ and the attribute is ‘nurbsSphere1.translateX’:

import maya.cmds as mc
setName = 'point_lightSet'
attribute = 'nurbsSphere1.translateX'
mc.sets(attribute,add =setName)

If you just wanted to create a set from a list of attributes,  you’d wanna call that list into the sets command like this:


I’m curious if anyone out there has an older version of maya (<2011) that this doesn’t work on. Maybe it didn’t allow for this at one point in time and I missed when it changed.

Comments are closed.