/* ------------------------------------------------------------------------------------- \\\\\\\\__________________________PIPE CURVES v1.0___________________________//////// //////// \\\\\\\\ ------------------------------------------------------------------------------------- > Written by dimitris gourdoukis. > object-e architecture 2008. ------------------------------------------------------------------------------------- > http://object-e.blogspot.com/ > object.e.architecture@gmail.com ------------------------------------------------------------------------------------- > v1.0 Last Modified 5/18/08. > Use and modify at your own risk. ------------------------------------------------------------------------------------- > Description: This script creates pipes around each of the selected curves and 'caps' the pipes by placing one sphere on both ends of the curve. ------------------------------------------------------------------------------------- */ proc pipeCurves (){ //list the selected curves string $curvelist[] = `ls -sl`;; $size = size($curvelist); float $pipeRadius = `floatSliderGrp -q -v pipeRadius`; //create the profile circle circle -ch on -o on -nr 0 1 0 -r $pipeRadius -n profile; for ($i=0; $i<$size; $i++){ //extrude the profile along the curve extrude -ch true -rn false -po 0 -et 2 -ucp 1 -fpt 1 -upn 1 -rotation 0 -scale 1 -rsp 1 "profile" $curvelist[$i] ; //get the number of cvs string $xero1 = "getAttr \"" + $curvelist[$i] + ".cv[*]\""; float $convs [] = eval ($xero1); $arraySize = size($convs); int $lastCV = $arraySize/3 - 1; //get the coordinates of the start point string $xero2 = "getAttr \"" + $curvelist[$i] + ".cv[0]\""; vector $start = eval ($xero2); $ssx = $start.x; $ssy = $start.y; $ssz = $start.z; //get the coordinates of the end point string $xero3 = "getAttr \"" + $curvelist[$i] + ".cv[" + $lastCV + "]\""; vector $end = eval ($xero3); $sex = $end.x; $sey = $end.y; $sez = $end.z; //create and move the spheres polySphere -r $pipeRadius; move $ssx $ssy $ssz; polySphere -r $pipeRadius; move $sex $sey $sez; } select -r profile ; doDelete; } global proc constructPipeWin () { if (`window -exists pipeWindow`) { deleteUI pipeWindow; } window -width 400 -height 200 -title "pipe curves" -sizeable true pipeWindow; columnLayout; text -l ""; floatSliderGrp -label "radius" -field true -fieldStep 0.1 -sliderStep 0.1 -value 1 -fieldMinValue 0 -fieldMaxValue 100 pipeRadius; //create button button -label "Pipe" -command "pipeCurves" buildIt; setParent ..; //break columnLayout; text -l ""; separator -w 800 -h 4 -backgroundColor 1 0.663 1; text -l "object-e / dimitris gourdoukis. 2008."; text -l "http://object-e.blogspot.com/"; showWindow; } constructPipeWin;