Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 02-10-2012 , 02:25 AM
Chirone's Avatar
Subscriber
Join Date: Dec 2007
Location: NZ
Posts: 3,125

NURBS to Poly conversion and uv layout

I'm trying to write a script where I create a NURBS sphere, do some random stuff to the isoparams and control vertices, convert it to a polygon object and then do a planar projection on it.

I think my biggest problem so far is that I don't know how to select something that I've just created

So far I am able to create the NURBS sphere with this:
Code:
CreateNURBSSphere;
setAttr "makeNurbSphere4.endSweep" 180;
rotate -r -os -90 0 0 ;
displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3;
subdivDisplaySmoothness -smoothness 3;

select -r nurbsSphere4.u[1.53] ;
select -tgl nurbsSphere4.u[2.52] ;
InsertIsoparms;
insertKnotSurface -ch 1 -nk 1 -add 1 -ib 0 -rpo 1  -d 1  -p 1.53 -p 2.52;
the problem here is I don't think it's really abstract, because it looks like it only works on the object called nurbsSphere4.
so... how do i make a NURBS object and select it straight after?


When I go to select the object and convert it to polygons and then do a planar projection I see these lines appear int he script window
Code:
nurbsToPoly -mnd 1  -ch 1 -f 2 -pt 1 -pc 200 -chr 0.1 -ft 0.01 -mel 0.001 -d 0.1 -ut 3 -un 2 -vt 3 -vn 2 -uch 0 -ucr 0 -cht 0.01 -es 0 -ntr 0 -mrt 0 -uss 1;

hilite nurbsToPoly4 ;
selectMode -component ;
select -r nurbsToPoly5.f[0:95] ;
polyProjection -ch 1 -type Planar -ibd on -md x nurbsToPoly4.f[0:95];
;
setAttr "polyPlanarProj2.rotateY" 0;
setAttr "polyPlanarProj2.rotateX" 90;
setAttr "polyPlanarProj2.projectionWidth" 7;
setAttr "polyPlanarProj2.projectionHeight" 7;
How do I select the newly created polygon and found out what the numbers are for the range [0:95]?




that's a "Ch" pronounced as a "K"

Computer skills I should have:
Objective C, C#, Java, MEL. Python, C++, XML, JavaScript, XSLT, HTML, SQL, CSS, FXScript, Clips, SOAR, ActionScript, OpenGL, DirectX
Maya, XSI, Photoshop, AfterEffects, Motion, Illustrator, Flash, Swift3D
# 2 02-10-2012 , 03:02 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
The sphere is selected right after creation but its a good idea to store the obj in a variable.

like:

Code:
// I used the sphere command instead, and that needs an array to hold this return info.
// And for the sake of simplicity,  I only used the endSweep flag to show that you can cut out a lot of
// extra lines by using flags to set initial attributes.

string $makeBall[] = `sphere -endSweep 180`; 

// the actual object is the first item in the array. Even though you can use $makeBall[0] to act on the
// object, it's kinda messy looking.

string $ball = $makeBall[0];


// so now you can call on the $ball variable and do stuff to it

scale -relative 10 10 10 $ball;
setAttr ($ball + ".visibility") 0;

The second question I'm not quite clear on. I know that "select -r nurbsToPoly5.f[0:95]" is saying you have all the faces from 0 through 95 selected. If you turn on show number for faces in the custom polygon display you can check out whats what.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 3 02-10-2012 , 03:16 AM
Chirone's Avatar
Subscriber
Join Date: Dec 2007
Location: NZ
Posts: 3,125
a, sweet, thanks!

as for the second, I figured it was selecting the faces 0 to 95, so I guess if I knew how many faces there are I can fill out the range.




that's a "Ch" pronounced as a "K"

Computer skills I should have:
Objective C, C#, Java, MEL. Python, C++, XML, JavaScript, XSLT, HTML, SQL, CSS, FXScript, Clips, SOAR, ActionScript, OpenGL, DirectX
Maya, XSI, Photoshop, AfterEffects, Motion, Illustrator, Flash, Swift3D
# 4 02-10-2012 , 09:59 AM
Chirone's Avatar
Subscriber
Join Date: Dec 2007
Location: NZ
Posts: 3,125
You can convert to poly with the nurbsToPoly command
Code:
string $mesh[] = `nurbsToPoly
and then do a planar project like so:
Code:
int $numFaces[] = `polyEvaluate -face $mesh[0]`;
string $projection[] = `polyProjection -ch 1 -type Planar -ibd on -md x ($mesh[0] + ".f[0:" + ($numFaces[0] - 1) + "]")`;
setAttr ($projection[0] + ".rotateY") 0;
setAttr ($projection[0] + ".rotateX") 90;
setAttr ($projection[0] + ".projectionWidth") 7;
setAttr ($projection[0] + ".projectionHeight") 7;




that's a "Ch" pronounced as a "K"

Computer skills I should have:
Objective C, C#, Java, MEL. Python, C++, XML, JavaScript, XSLT, HTML, SQL, CSS, FXScript, Clips, SOAR, ActionScript, OpenGL, DirectX
Maya, XSI, Photoshop, AfterEffects, Motion, Illustrator, Flash, Swift3D
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off