--A number of different macros to speed up constraining objects --From Rob Galanakis at http://www.robg3d.com --functions that takes an object and the target to constrain it to, and sets an orientation or position constraint fn assignPosConstraint conObj targetObj = ( conObj.position.controller.appendTarget targetObj 50.0 ) fn assignRotConstraint conObj targetObj = ( conObj.rotation.controller.appendTarget targetObj 50.0 ) --these macros are based on Maya's Constaint tools: select the object to constain, and then at least one target to constain to --assign both position and rotation constraints macroScript constrainPositionAndRotation category:"RobG3D Scripts" ( if selection.count >= 2 then ( selection[1].position.controller = Position_Constraint () selection[1].rotation.controller = Orientation_Constraint () for i in 2 to selection.count do ( assignPosConstraint selection[1] selection[i] assignRotConstraint selection[1] selection[i] ) ) else (print "Constained Object then Constaint Target Object(s)") ) --assign orientation constraint only macroScript constrainRotation category:"RobG3D Scripts" ( if selection.count >= 2 then ( selection[1].rotation.controller = Orientation_Constraint () for i in 2 to selection.count do ( assignRotConstraint selection[1] selection[i] ) ) ) --assign position constraint only macroScript constrainPosition category:"RobG3D Scripts" ( if selection.count >= 2 then ( selection[1].position.controller = Position_Constraint () for i in 2 to selection.count do ( assignPosConstraint selection[1] selection[i] ) ) else (print "Constained Object then Constaint Target Object(s)") ) --some quick macros for removing position or orientation constraints in all selected objects macroScript constrainPosRemove category:"RobG3D Scripts" ( if selection.count > 0 then ( for i in selection do ( i.position.controller = Position_XYZ () ) ) ) macroScript constrainRotRemove category:"RobG3D Scripts" ( if selection.count > 0 then ( for i in selection do ( i.rotation.controller = Euler_XYZ () ) ) ) --Following two scripts are for mass-constraining at a time. The first, third, fifth, etc., objects selected --are the objects you will assign a constraint to. The second, fourth, sixth, etc., objects selected are the --targets for their preceding 'odd' partners. For example, 2 is the constraint target for 1, 4 the target for 3, etc. --constrain position en masse macroScript constrainPositionMass category:"RobG3D Scripts" ( if selection.count >= 2 then ( for i in 1 to selection.count by 2 do ( selection[i].position.controller = Position_Constraint () assignPosConstraint selection[i] selection[i + 1] ) ) else (print "Odd selections are constrained objects, even are constraint targets") ) --constrain rotation en masse macroScript constrainRotationMass category:"RobG3D Scripts" ( if selection.count >= 2 then ( for i in 1 to selection.count by 2 do ( selection[i].rotation.controller = Orientation_Constraint () assignRotConstraint selection[i] selection[i + 1] ) ) else (print "Odd selections are constrained objects, even are constraint targets") )