Selecting specific vertex numbers in attached splines

I don't know if there's anything like this already out there, but I couldn't find it if so. A friend of mine asked if this was possible, and I couldn't think of any standard Max operations to handle it, so it must be a scripting solution.

The problem is, he has a group of splines being used as guide splines for hair and fur. Each spline consists of just one segment (two vertices). All segments are attached as one editable spline, so in subobject mode, the bottom vertex of each spline is vertex 1, and the top is vertex 2. Is there a script which would allow him to easily select vertex 2 on each spline in subobject mode all at once? Obviously, he could use the paint selection tools, and different viewport perspectives to get the required selections, but seems like it would just be so much easier if there were a way to grab every vertex that was assigned to number 2, or 1, etc.

Here's a screenshot of what the splines look like... (see attached). It's basic Hair and Fur guide splines generated by maxscript.

AttachmentSize
file_505479.jpg296.67 KB

Comments

Comment viewing options

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

Script

That is exactly what I was needing. I appreciate LuxXeon for posting this request and really am grateful for your posting of this script. This does exactly what I was needing to do!

barigazy's picture

...

Something like this?

try(destroyDialog ::bgaRoll)catch()
rollout bgaRoll "• • •"
(
	fn filtSpline spl = isKindOf spl Line or isKindOf spl SplineShape
	fn deselectAllKnots spl = for s = 1 to numSplines spl do setKnotSelection spl s #()
	fn select_n_knots spl s idx = setKnotSelection spl s #(idx) keep:on
	spinner spn_knot "Knot Index *n*: " pos:[5,5] fieldwidth:30 range:[1,2,1] type:#integer
	button btn_select "Select All *n* Knots" pos:[5,25] width:124
	on btn_select pressed do if selection.count != 1 then messageBox "Select One Shape Object" title:"Warning" beep:off else
	(
		if filtSpline selection[1] do
		(
			deselectAllKnots selection[1]
			for s = 1 to numSplines selection[1] do select_n_knots selection[1] s spn_knot.value
		)
	)
)
createDialog bgaRoll 135 50 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

barigazy

luxxeon's picture

Thank you!

That script worked perfectly. Thanks for your help, barigazy!

barigazy's picture

...

My pleasure ;)

barigazy

nodecomp's picture

Save me a huge amount of aggrivation

I really wanted to say thank you once again for your script. I have never been good with programming of any sort. I was able to complete the multiple fur pieces for a total of almost 4 million hairs in less than a few hours! Hat's off to you, sir!

Comment viewing options

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