# Smoothvalue Control

**URL:** https://forum.highend3d.com/t/smoothvalue-control/3074
**Category:** Maya
**Tags:** mel
**Created:** [May 26, 2006, 2:03pm UTC](https://forum.highend3d.com/t/smoothvalue-control/3074 "2006-05-26T14:03:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vincenzol](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/v/51bf81/32.png) [@vincenzol](https://forum.highend3d.com/u/vincenzol)
#### Post date: [May 26, 2006, 2:03pm UTC](https://forum.highend3d.com/t/smoothvalue-control/3074/1 "2006-05-26T14:03:24Z")

</div>

Hi all folks,  
i'd need a help to create a "SmoothValue Controller".  
I want to connect the ".division" attribute of the selected objects' polySmoothFace node to a slider.  
I wrote this:

spaceLocator -p 0 0 0 -n smoothCtrl;  
addAttr -ln smoothValue -at long -min 0 -max 3 -dv 1 |smoothCtrl;  
setAttr -e -keyable true |smoothCtrl.smoothValue;

string $obj[] = `ls -et "polySmoothFace"`;

for ($node in $obj)  
{  
string $smooth = $node+ ".divisions";  
connectAttr smoothCtrl.smoothValue $smooth;

but it works only on all objects on the scene. What I need is to add some little code to perform the connection on selected objects only.

Thanks in advance for the help,  
Vincenzo

---

<div class="post-metadata">

### Author: ![vincenzol](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/v/51bf81/32.png) [@vincenzol](https://forum.highend3d.com/u/vincenzol)
#### Post date: [May 27, 2006, 7:30am UTC](https://forum.highend3d.com/t/smoothvalue-control/3074/2 "2006-05-27T07:30:56Z")

</div>

Hi there, i solved the problem by adding a "-listConnections" command to make a list of objects in my selection that have the node "polySmoothFace":

//here I create a control object  
spaceLocator -p 0 0 0 -n smoothCtrl;  
addAttr -ln smoothValue -at long -min 0 -max 3 -dv 1 |smoothCtrl;  
setAttr -e -keyable true |smoothCtrl.smoothValue;

//here I select the shapes, that may have connections to polySmoothFace node  
select -hi;

//here I create the list of objects in my selection that have polySmoothFace connections   
string $sel[] = `ls -sl`;  
string $conn[] = `listConnections -t polySmoothFace $sel`;  
print $conn;

//Here I connect the control object to every divisionValue of the poly smoothed objects  
for ($node in $conn)  
{  
 string $smooth = $node+ ".divisions";  
 connectAttr smoothCtrl.smoothValue $smooth;

};

hope this can help ![](http://www.highend3d.com/boards/style_emoticons/<#EMO_DIR#>/smile.gif)  
Vincenzo
