Form and Space

creating CG 3D since 2001

  • Connect @
  • Linked in
  • Vimeo
  • Twitter

Maya: Universal Duplicate

Matthew | August 26, 2012


The duplicate tool in Softimage is brilliant. No matter what you select, it will be duplicated relative to the object type. I want that in Maya, or at least some of it. So I wrote this tonight. It’s a start. It will work well in modeling processes. I remapped this script to the ctrl+d, replacing the default tool in Maya. More at

Universal Duplicate
version 0.2

Author:  Matthew L. Stoehr

Objective:  Create a duplicate tool that can be universally used 
for all objects and components.

Currently this tool can:
if the selection is a polygon, point, or edge, runs relevant polyExtrude
if the selection is an object, runs duplicate -un;
if the selection is an isoparm, runs duplicateCurve -ch;
if the selection is an surface patch, runs duplicateSurface -ch;

proc mls_universalDuplicate()
string $myCollection[] = `ls -sl`;
int $n = size($myCollection);

if($n > 0){
    string $id = `nodeType $myCollection[0]`;
    print ($id + "\n");
    print ($n + "\n");
    if($id == "mesh"){ 
        string $faces[] = `filterExpand -sm 34`;
        string $vertices[] = `filterExpand -sm 31`;
        string $edges[] = `filterExpand -sm 32`;
        if(size($faces)>0 || size($vertices)>0 || size($edges)>0){
    }else if($id == "transform"){
        //I want to duplicate my inputs, so they are unqiue
        duplicate -upstreamNodes;
    }else if($id == "nurbsSurface"){
        string $isoparms[] = `filterExpand -sm 45`;
        int $totalIsoparms = size($isoparms);
        string $patches[] = `filterExpand -sm 72`;
        int $totalPatches = size($patches);
        if($totalIsoparms > 0){
            for ($i = 0; $i < $totalIsoparms; $i++){
                select -r $isoparms[$i];
                string $myDupCrv[] = `duplicateCurve -n ("mls_dupCrv_" + $i) -ch 1`;
            select -r $isoparms;           
        if($totalPatches > 0){
            string $myDupSrf[] = `duplicateSurface -ch 1`;
        //optional individual patches  
        /*if($totalPatches > 0){
            for ($i = 0; $i < $totalPatches; $i++){
                select -r $patches[$i];
                string $myDupSrf[] = `duplicateSurface -ch 1`;
        duplicate -rr;
if ($n == 0){
    print ("Select component(s) or object(s)");

2 responses to “Maya: Universal Duplicate”

  1. Matthew says:

    Updated. Fixed duplication of all nodeTypes, such as shaders.

Leave a Reply