  | | | Newbie - mel - Getting points, vrtx or controlpoints | Newbie - mel - Getting points, vrtx or controlpoints 2003-12-03 - By Andres Ramirez
Back How about just going myObject.cv["*"]["*"]? That seemed to work for me. Then I can use the -flatten flag with ls.
Thank you so much for all the nurb references though, that will come in handy.
- Andres
On Tuesday, December 2, 2003, at 02:37 PM, Bryan Ewert wrote:
> ? from Tue, 2 Dec 2003 10:33:03 -0600 > >>> So I either need to find a way to automatically select all the CV's >>> or >>> somehow get a list of them. > >> hilite -r $obj; >> eval ("hilite -r " + $obj + ".vtx[0:2000000]"); > > Oi. Sorry, but that's just too sloppy for me. :) > > The CVs on a NURBS curve are selectable via the ".cv" attribute of the > curve. Edit points are selectable via the ".ep" attribute. > > To determine the number of CVs for a NURBS curve: > > string $curve = "curveShape1"; > > int $numSpans = `getAttr ( $curve + ".spans" )`; > int $degree = `getAttr ( $curve + ".degree" )`; > int $form = `getAttr ( $curve + ".form" )`; > > int $numCVs = $numSpans + $degree; > > // Adjust for periodic curve: > if ( $form == 2 ) $numCVs -= $degree; > > Thus, to select or modify all CVs on the curve: > > int $cv; > for ( $cv = 0; $cv < $numCVs; $cv++ ) > { > // The CV; e.g. "curveShape1.cv[0]" > string $cvAttr = ( $curve + ".cv[" + $cv + "]" ); > > // The edit point; e.g. "curveShape1.ep[0]" > string $cvAttr = ( $curve + ".ep[" + $cv + "]" ); > > select $cvAttr; // or whatever > } > > Related MEL How-To's: > > How do I determine how many CVs are in a NURBS Curve or > Surface? > > http://www.ewertb.com/maya/mel/mel_a58.html > > How can I determine the world space coordinates of NURBS > surface edit points? > > http://www.ewertb.com/maya/mel/mel_a20.html > > If you're dealing with polygon mesh objects, you can use the > "polyEvaluate" > command to determine the number of vertices in the mesh: > > string $mesh = "pSphereShape1"; > > polyEvaluate -vertex $mesh; > // Result: 114 // > > An annoying behavior of this command is that it always returns an int > array, > forcing you to capture its results like this: > > int $numVtx[] = `polyEvaluate -vertex $mesh`; > > int $vtx; > for ( $vtx = 0; $vtx < $numVtx[0]; $vtx++ ) > { > string $vtxAttr = ( $mesh + ".vtx[" + $vtx + "]" ); > > // Do work the $vtxAttr here. > } > > You can then loop through the vertices similar to the CVs. > > > Sidebar: You won't find the ".cv" or ".ep" attributes listed in the > Connection Editor, or in the node documentation for a nurbsCurve. > These are > "virtual" attributes - perhaps aliases, I'm not sure how they defined > and > interpreted - similar to the ".vtx" and ".e" attributes on a polygon > mesh. > Does someone knows the story behind these? > > -- > Bryan Ewert ? maya@(protected) ? http://www.ewertb.com ? > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- > List-help: <mailto:listar@(protected)?Subject=help> > List-unsubscribe: <http://www.highend3d.com/maya/listserver/> > List-subscribe: <http://www.highend3d.com/maya/listserver/> > List-archive: <http://www.highend3d.com/maya/archive/> > > Andres Ramirez Pixeldream Inc. andres@(protected) http://www.pixeldream.com P: 201-963-6063 C: 617-413-8582
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-unsubscribe: <http://www.highend3d.com/maya/listserver/> List-subscribe: <http://www.highend3d.com/maya/listserver/> List-archive: <http://www.highend3d.com/maya/archive/>
|
|
 |