creating ep curve , driving me mad :(!


#1

hello,

i have a recurring problem with ep curves that never seems to resolve. but i feel I’m getting closer.

If you manually create a curve from edit points in maya you will create a curve with evenly spaced curve spans between each edit point eg. 0 to 1, 1 to 2, 2 to 3 etc

if you create an ep curve through python like this:

cmds.curve(d=3, n=‘curve1’, ep=[(0, 0, 0), (3, 5, 6), (10, 12, 14), (9, 9, 9)] )

the parameterisation is automatically set to the chord length, not split evenly along the points.

when creating the same curve manually it seems, looking at the script editor, that maya converts the ep curve into a normal cv curve with knots to make the curve line up with the original edit point positions, giving the even spans.

this may not be clear to understand. But basically i want to be able to write a python command to create an ep curve in exactly the same way that maya creates an ep curve when entered manually. so i can get those even spans between points

hope this makes sense, any help on this would be great

Sam


#2

never mind found an api solution from another forum

	curveFn = om.MFnNurbsCurve() 
	arr = om.MPointArray() 
	
	for pos in coords: 
	    arr.append(*pos) 
	
	curveFn.createWithEditPoints( 
                                  arr, 
                                  3, 
                                  om.MFnNurbsCurve.kOpen, 
                                  False, 
                                  False, 
                                  True 
                         	    )