Center Pivot on many objects all at once

Unhandled Perfection
Unhandled — Maya
1 min readFeb 10, 2018

A situation where this could be needed is when importing external data for example from curve schematic data from a program like AutoCad. After the import the pivots to each cuve is nowhere near the object. With the following mel script we can center the pivot for all selected objects in one go.

The pivot of the imported content is nowhere near the actual element and this is the case for every imported element.

Code

string $selectedObjects[] = `ls -sl`;
string $currentObj;
for ($currentObj in $selectedObjects) {
// center $currentObj's pivot
xform -cp $currentObj;
}

Steps

  1. Selected objects in viewport.
  2. Open Script Editor from Window > General Editors > Script Editor.
  3. Paste the above code in the bottom half of the script editor.
  4. Run the code by selecting menu Command > Execute.

Result

The pivot is now appropriately centered for each element.

--

--