pymel.core.general.matchTransform

matchTransform(*args, **kwargs)

This command modifies the source object’s transform to match the target object’s transform. If no flags are specified then the command will match position, rotation and scaling.

Flags:

Long Name / Short Name Argument Types Properties
pivots / piv bool ../../../_images/create.gif
  Match the source object(s) scale/rotate pivot positions to the target transform’s pivot.
position / pos bool ../../../_images/create.gif
  Match the source object(s) position to the target object.
rotation / rot bool ../../../_images/create.gif
  Match the source object(s) rotation to the target object.
scale / scl bool ../../../_images/create.gif
  Match the source object(s) scale to the target transform. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.matchTransform

Example:

::

import pymel.core as pm

# create a cone and randomly transform it pm.polyCone(n=’cone1’) # Result: [nt.Transform(u’cone1’), nt.PolyCone(u’polyCone1’)] # pm.scale(0.2, 2.0, 0.2); pm.rotate(20, 45, 70) pm.move(-2, 0, 2)

# create a cylinder pm.polyCylinder(n=’cylinder1’) # Result: [nt.Transform(u’cylinder1’), nt.PolyCylinder(u’polyCylinder1’)] #

# modify the cylinder’s transform to match the cone pm.matchTransform(‘cylinder1’,’cone1’)