# Transfer Ncloth Presets To Multiple Objects

**URL:** https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581
**Category:** Maya
**Tags:** cloth
**Created:** [May 28, 2009, 9:46am UTC](https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581 "2009-05-28T09:46:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mrwolfy](https://forum.highend3d.com/user_avatar/forum.highend3d.com/mrwolfy/32/134_2.png) [@mrwolfy](https://forum.highend3d.com/u/mrwolfy)
#### Post date: [May 28, 2009, 9:46am UTC](https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581/1 "2009-05-28T09:46:43Z")

</div>

Anybody know how to transfer nCloth presets to multiple objects in a single selection?

Thanks,

Wolfy

---

<div class="post-metadata">

### Author: ![eebling](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/e/ce73a5/32.png) [@eebling](https://forum.highend3d.com/u/eebling)
#### Post date: [July 13, 2011, 3:31pm UTC](https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581/2 "2011-07-13T15:31:14Z")

</div>

well the only way i figured out was to write a little script.... this has the name of the preset you wanna use hardcoded into it, so change it to whatever name you wanna use and select the nCloth nodes in the outliner and run it

// select as many nCloth nodes as you want, run this script to apply a preset to them

// change the name of the preset to whichever you want in the script below

// this by default fully replaces the settings with the named preset

{

int $size, $n;

string $sel[] = `listRelatives -s`;

$size = size($sel);

for($n=0; $n\<$size; $n++){

applyPresetToNode $sel[$n] "" "" "dentedMetal\_panel" 1;

}

}

---

<div class="post-metadata">

### Author: ![deisengard](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/d/dec6dc/32.png) [@deisengard](https://forum.highend3d.com/u/deisengard)
#### Post date: [October 29, 2014, 11:24pm UTC](https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581/3 "2014-10-29T23:24:25Z")

</div>

I know this is an ancient post, but since there seemed to be so little out there about this and since the above code didn't work for me (and caused me quite a headache because MEL sucks, not to mention it's just retarded that you can't apply a preset to more than one object through the UI), I figured I'd post my solution for the next poor soul, in Python, because MEL syntax wasn't making any sense.

```auto
import maya.cmds as mc
import maya.mel as mel
 
def applyClothPreset(name, blendVal=1):
    nCloths = mc.ls(sl=True, type="transform")
 
    for n in nCloths:
        nClothShapes = mc.listRelatives(n, shapes=True)
        for s in nClothShapes:
            print "%s|%s %s %4.1f" % (n, s, name, blendVal)
            mel.eval("applyAttrPreset %s|%s \"C:/Program Files/Autodesk/Maya2014/presets/attrPresets/nCloth/%s.mel\" %4.1f" % (n, s, name, blendVal))
 
applyClothPreset("solidRubber")
applyClothPreset("waterBalloon", 0.3)
```

Obviously this only works for built-in presets... modify path accordingly.  
&nbsp;

---

<div class="post-metadata">

### Author: ![reza-nir](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/r/53a042/32.png) [@reza-nir](https://forum.highend3d.com/u/reza-nir)
#### Post date: [July 11, 2017, 6:40pm UTC](https://forum.highend3d.com/t/transfer-ncloth-presets-to-multiple-objects/40581/4 "2017-07-11T18:40:28Z")

</div>

#lock u and v before apply  
import maya.cmds as mc  
import maya.mel as mel

def applyFolliclePreset(name, blendVal=1):  
nCloths = mc.ls(sl=True, type=“transform”)

```
for n in nCloths:
    nClothShapes = mc.listRelatives(n, shapes=True)
    for s in nClothShapes:
        print "%s|%s %s %4.1f" % (n, s, name, blendVal)
        mel.eval("applyAttrPreset %s|%s \"C:/Users/reza_cg/Documents/maya/2017/presets/attrPresets/follicle/%s.mel\" %4.1f" % (n, s, name, blendVal))

```

applyFolliclePreset(“My\_Preset”)
