//version 1: not working due to the curve command does not accept the string as flag.

//load resource
source "H:/vsfx705/mel/PolyMeshUtils.mel";
string $myobject[] = `ls -sl`;
print ("the quary name is" + $myobject[0]);
$verts = getVertices($myobject[0]);
print $verts;

//-----get total number of vertex-------
int $num[] = `polyEvaluate -v $myobject[0]`;
print ($num[0]);

int $nverts = $num[0];

//----set up the command for curve
int $n;
string $cc=" ";
for($n = 0; $n < $num[0]; $n++)
{
$cc= $cc + " -p " +$verts[$n];
print (" the versts is " + $verts[$n] + "\n");
//curve -p 0 0 0 -p $verts[$n] -p $verts[$n+1] -p 0 0 0;
}

print ("hello" + $cc);
//EPCurveTool;
//curve $cc;
//print (" the first versts is " + $verts[0]);
//curve -d 1 -p ($verts[0].x) ($verts[0].y) ($verts[0].z) -p ($verts[1].x) ($verts[1].y) ($verts[1].z) -p ($verts[2].x) ($verts[2].y ($verts[2].z) -p ($verts[3].x) ($verts[3].y) ($verts[3].z) ;

curve -p $verts[1] -p $verts[2] -p $verts[3] -p $verts[4];
//curve -p 0 0 0 -p 3 5 6 -p 5 6 7 -p 9 9 9;

 

 

 

version 2: I created a linear curve (straight lines) between two vertex to form an continous string.

//get the x y z position of vertex

global proc vector[] getVertices2(string $tnode)
{
int $num[] = `polyEvaluate -v $tnode`;
int $nverts = $num[0];
vector $verts[];

int $n;
for($n = 0; $n < $num[0]; $n++)
{
$item = $tnode + ".vtx[" + $n + "]";
$pnt = `pointPosition -world $item`;
float $x = $pnt[0];
float $y = $pnt[1];
float $z = $pnt[2];
vector $v = << $x, $y, $z >>;
$verts[$n] = $v;

//--get the second node
$item = $tnode + ".vtx[" + ($n+1) + "]";
$pnt2 = `pointPosition -world $item`;
float $x2 = $pnt2[0];
float $y2 = $pnt2[1];
float $z2 = $pnt2[2];

curve -p $x $y $z -p $x $y $z -p $x2 $y2 $z2 -p $x2 $y2 $z2;

//individual straight lines

//curve -d 0 -p $x $y $z -p $x2 $y2 $z2 ;

//single smooth line

//curve -d 3 -a -p $x $y $z curve1;


}
return $verts;
}

//source "H:/vsfx705/mel/PolyMeshUtils.mel";

string $myobject[] = `ls -sl`;
print ("the quary name is" + $myobject[0]);
$verts = getVertices2($myobject[0]);
print $verts;

 

change mel to: curve -a -p $x $y $z curve1;

version 3: lines loop from last back to first. break into individual lines to make NURB extrude right. Lines are grouped

//get the x y z position of vertex

global proc vector[] getVertices2(string $tnode)
{
int $num[] = `polyEvaluate -v $tnode`;
int $nverts = $num[0];
vector $verts[];
string $result[];

//--get the first node
$item = $tnode + ".vtx[" + 0 + "]";
$pnt3 = `pointPosition -world $item`;
float $x3 = $pnt3[0];
float $y3 = $pnt3[1];
float $z3 = $pnt3[2];

//--get the last node
$item = $tnode + ".vtx[" + $num[0] + "]";
$pnt4 = `pointPosition -world $item`;
float $x4 = $pnt4[0];
float $y4 = $pnt4[1];
float $z4 = $pnt4[2];

//create a line
curve -d 1 -p $x4 $y4 $z4 -p $x3 $y3 $z3 -n curve1;

//make a group
$gname = `group -em`;
$gname = `rename "curveGroup"`;
parent curve1 $gname;

int $n;
for($n = 0; $n < $num[0]; $n++)
{
$item = $tnode + ".vtx[" + $n + "]";
$pnt = `pointPosition -world $item`;
float $x = $pnt[0];
float $y = $pnt[1];
float $z = $pnt[2];
vector $v = << $x, $y, $z >>;
$verts[$n] = $v;

$item = $tnode + ".vtx[" + ($n+1) + "]";
$pnt2 = `pointPosition -world $item`;
float $x2 = $pnt2[0];
float $y2 = $pnt2[1];
float $z2 = $pnt2[2];

$result[$n] = `curve -d 1 -p $x $y $z -p $x2 $y2 $z2` ;
//curve -d 3 -a -p $x $y $z curve1;

//parent result to primary group

parent $result[$n] $gname;
}
return $verts;
}

//source "H:/vsfx705/mel/PolyMeshUtils.mel";

string $myobject[] = `ls -sl`;
print ("the quary name is" + $myobject[0]);
$verts = getVertices2($myobject[0]);
print $verts;



d=1


d=3. Urban calligraphy

 

some test in Renderman