Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

How to make an object position follow the CV of a curve

flbishop
Community Visitor

How to make an object position follow the CV of a curve

flbishop
Community Visitor
Community Visitor

I have an issue I'm getting with an expression to match CV translation. I have a NURBS curve with a few CVs. I want an expression that makes the translations of a group (called "grp") match a specific CV on the curve. cv 4 in this case.

 

$globalUpdate_X = control.translateX;
$globalUpdate_Y = control.translateY;
$globalUpdate_Z = control.translateZ;
float $curve_cv1[] = `xform -q -ws -t curve.cv[4]`;
grp.translateX = $curve_cv1[0];

grp.translateY = $curve_cv1[1];
grp.translateZ = $curve_cv1[2];

 

When I edit the expression, the group pops the curve to where I would expect. When I translate the control, expecting the expression to fire off, I get this error: // Error: line 3: No object matches name: curve.cv [4]

0 Likes
Reply
1,544 Views
4 Replies
Replies (4)

viru.gupta8
Enthusiast
Enthusiast

Hey,

As you are saying you have curve that have 4 cv.

so those will be cv[0], cv[1], cv[2], cv[3]

and in your code you are using cv[5] that might not be in curve so maya is throwing error "No object matches name: curve.cv [4]"

0 Likes

flbishop
Community Visitor
Community Visitor

I can select the CV that it tells me it doesn't have. I am literally typing in the name, and it returns the CV. The code also works before I put the global update in.

0 Likes

Anonymous
Not applicable

You can do this with the curveInfo node.  The resulting xyz positions will be in world of the curve.

 

followCV.jpeg

0 Likes

sean.heasley
Alumni
Alumni

Hi @flbishop

 

I'm just checking in to see if you need more help with this. Did the suggestion that @Anonymous provided work for you?

If so, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

0 Likes