Adding component to Rigid Group

Is there any method which can add several components to a new rigid group/old rigid group (which is already created) in a motion study. I have to use solidworks api to do so.

SolidworksApi macros