Hi,
I'm working on a script to place cylinders on selected faces for booleans. I need to place the first selected object into a token so I can call it up, but am confused on how I can bring the selection into a string to tokenize between the "."
The script is meant to allow me to select adjacent components on a poly surface to create a cylinder on the the center of those selected pieces.
global proc Circle()
{
string $array[] = `ls -selection`;
print $array;
for ($item in $array)
{
string $currentTool = `currentCtx`;
setToolTo moveSuperContext;
vector $pos = `manipMoveContext -q -p Move`;
string $loc[] = `polyCylinder -r 1 -h 2 -sx 10 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1 -n "cutter#"`;
move -ws -a ($pos.x) ($pos.y) ($pos.z) $loc;
setToolTo $currentTool;
select $array;
select -tgl $loc;
normalConstraint -weight 1 -aimVector 0 1 0 -upVector 0 1 0 -worldUpType "scene";
select $array;
}
}
so I need to tokenize the selection so that the script only works on the first selected object (for example, if I have pSphere1 and pSphere2 selected, I need it to only work on pSphere1). I also need at the end to select the original selection again from components up, probably with a polyListcomponentConversion.
Does anyone have any pointers?
Replies
$selectionArray = `ls -sl -fl`;
string $newArray [];
tokenize $selectionArray[0] "." $newArray;
print $newArray;
global proc circleCut()