PDA

View Full Version : Moving Points from NURBS curves


Phlok
12-01-2008, 08:33 PM
Hi,

I am trying to create a MEL script that does the following:

1. Select a nurbs curve
2. Select some points on the curve
3. Create an expression that animates the points selected in Y between position n(max) and n(min) over a given time (something like an oscillation).

Okay...my problem is when coding in MEL I often don't know how to get things done, I did a lot of tutorials though, but as I am an experienced programmer I know what variables are or how to use loops...(that's what most tutorials have been trying to tell me so far). I know how to script some stuff with dynamics and I also know how to create expressions from a MEL script, but I am not into geometry operations.

Here's my point, now:

I selected my curve's EPs doing that:

float $fEpsOfPath [] = `getAttr "curve1.ep
"`;

fine.

But now I am seeking for a way to change the EP's positions. I need to do a local transform on the curve, because I want to be able to place my oscillating curve freely around in the scene when I am done with the script (in fact, that's why am writing this stuff in the first place).

Something like (thinking in an OO- language)

curve1.ep[i].translateLocalX(0.5)

I kept searching all over the documentation but I couldn't make out what to do or what command I need for doing this.

So here's my questions:

1. Should I be using EPs in the first place or would you recommend using knots or CVs? If so- why?

2. Is there something like a best practice on how to do the transformations of the nodes? I mean, is there a command such as the one I posted above or do I need to set up a transform node?

Could you please be so kind an enlighten me?

Any help or hint is very much appreciated!

akril
12-02-2008, 11:44 AM
Hi Phlok,
You should have a look at the Cluster in Maya. In fact, it's not really accurate even not convenient to animate directly CVs on a curve. The best way should be to create One cluster for One CV and afterwards coded some MEL expressions in order to animate each cluster transforms ;-)
akril.

tbaypaul
12-02-2008, 05:46 PM
you could just replace the curve with one that has the new cv positions calculated for each frame. Given an existing curve1, an expression might look like this crude example.

$x = rand(0,1);
$y = rand(0,1);
$z = rand(0,1);
curve -d 3 -replace -p 1 2 3 -p $x $y $z -p 7 8 9 -p 10 11 12 curve1;

CGTalk Moderation
12-02-2008, 05:46 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.