global proc dupLoc() { //evenly distribute locators along a curve //using a motion path string $sectionCurves[]; float $curveVal = 0.0; int $divNumber[] = `intFieldGrp -q -v divFieldKL`; float $startTime = `playbackOptions -query -minTime`; float $endTime = `playbackOptions -query -maxTime`; //get the selection and create a locator and store them in strings string $sel[] = `ls -sl`; for($i = 0; $i <= $divNumber[0]; $i++) { //create the locator string $locator[] = `spaceLocator -p 0 0 0`; //attach the locator to the curve select -r $sel[0] $locator[0]; string $path = `pathAnimation -fractionMode true -follow true -followAxis x -upAxis y -worldUpType "vector" -worldUpVector 0 1 0 -inverseUp false -inverseFront false -bank true -startTimeU $startTime -endTimeU $endTime`; //set the newly created locater's Uvale according to a //value that is one divided by a user givien number float $uVal = (1.0/$divNumber[0]); setAttr ($path + ".uValue") $curveVal; /* //attach to the curve using a pointOnCurveInfo node string $tempHis[] = `listHistory $sel[0]`; string $node = `nodeType $tempHis[0]`; if($node == "nurbsCurve") { if($locator[0] != "") { string $temp_PosNode = `createNode pointOnCurveInfo`; connectAttr -f ($tempHis[0] + ".worldSpace[0]") ($temp_PosNode + ".inputCurve"); connectAttr -f ($temp_PosNode + ".position") ($locator[0] + ".translate"); setAttr ($temp_PosNode+".turnOnPercentage") 1; select -cl; } } */ $sectionCurves[$i] = `createBar($locator[0])`; $curveVal = $curveVal + $uVal; } print(size($sectionCurves) + "\n"); makeRoad($sectionCurves); } global proc string createBar(string $nam) { //print($nam + "\n"); //this code will creat and place a curve on a locator. string $loc = $nam; //string $locNam[] = `listRelatives -p $loc`; int $zVal = 1; vector $vecPos = <<0,0,1>>; //float $locPos[] = `xform -q -t -ws $locNam[0]`; vector $locVec = `xform -q -t -ws $nam`; vector $posPoint = $locVec + $vecPos; vector $negPoint = $locVec - $vecPos; string $createCurveA = "curve -d 1"; string $createCurveB = " -k 0 -k 1"; string $pointA = (" -p " + $posPoint.x + " " + $posPoint.y + " " + $posPoint.z); string $pointB = (" -p " + $negPoint.x + " " + $negPoint.y + " " + $negPoint.z); string $curveFnl = $createCurveA + $pointA + $pointB + $createCurveB; string $newCurve = `eval($curveFnl)`; select -r $newCurve; CenterPivot; select -r $nam $newCurve; pointConstraint -offset 0 0 0 -weight 1; select -cl; select -r $nam $newCurve; orientConstraint -offset 0 0 0 -weight 1; select -cl; setAttr ($newCurve + ".scaleZ") 4; return $newCurve; } global proc makeRoad(string $curves[]) { //select -r $curves; loft -ch 1 -u 1 -c 0 -ar 1 -d 3 -ss 1 -rn 0 -po 0 -rsn true $curves; } proc widthAdjust() { }