How to select specific vertices on a spline (so I can manipulate them) ?

I've got a very simple shape that I want to write an automated script for.

I want to select the two lowest vertices (they will both be on the same height on the z-axis, say maybe 0), and I want to invert that selection so I have all the other vertices and move those up the z-axis a particular amount.

How can I find my two lowest vertices in my spline?

PS - I am a newbie in MaxScripting and am going through AutoDesk's MaxScript Essentials book, but I can't see it in there.

Many thanks.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Try this:

(
	zOffset = 100
	function SortByXMember arr1 arr2 x:1 =
	(
		case of
		(
			(arr1[x].z < arr2[x].z):-1
			(arr1[x].z > arr2[x].z):1
			default:0
		)
	)
 
	if selection.count != 0 then
	(
		for o in selection where classOf o == Line or classOf o == SplineShape do
		(
			convertToSplineShape o
			for n = 1 to numSplines o do
			(
				kPosArr = for k = 1 to numKnots o n collect #(k, getKnotPoint o n k)
				qsort kPosArr SortByXMember x:2
 
				for k = 3 to kPosArr.count do
				(
					setKnotPoint o n kPosArr[k][1] (kPosArr[k][2] + [0,0, zOffset])
 
					setInVec o n kPosArr[k][1] ((getInVec o n kPosArr[k][1]) +  [0,0, zOffset])
					setOutVec o n kPosArr[k][1] ((getOutVec o n kPosArr[k][1]) +  [0,0, zOffset])
				)
				updateShape o
			)
		)
	)
	else
		messagebox "Select some splines." title:""
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.