Script to select spline vertex based on type

Hi!

I am looking for a script that will select spline vertices based on type. For example selecting only the corner vertices of a spline or just the bezier vertices of a spline. Any help would be much appreciated. Thanks!

Comments

Comment viewing options

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

.

Select the spline. Go to Vertex sub-object level, deselect all verts. Run this script:

(
	global rol_selKnotsByType
	try(destroyDialog rol_selKnotsByType)catch()
	rollout rol_selKnotsByType "Select knots by type"
	(
		radiobuttons rb_knotsType "" labels:#("Corner", "Smooth", "Bezier", "Bezier Corner") default:1 columns:2
		button btn_select "SELECT" width:190
 
		on btn_select pressed do
		(
			if selection.count != 0 do
			(
				selObjsArr = selection as array
 
				for o in selObjsArr where (classOf o == Line or classOf o == SplineShape) do
				(
					knotsToSelArr = #()
					splCnt = numSplines o
					if splCnt != 0 do
					(
						for ss = 1 to splCnt do
						(
							tmpArr = #()
							knotsCnt = numKnots o ss
							for k = 1 to knotsCnt do
							(
								knotType = getKnotType o ss k
								case rb_knotsType.state of
								(
									1:
									(
										if knotType == #corner do append tmpArr k
									)
									2:
									(
										if knotType == #smooth do append tmpArr k
									)
									3:
									(
										if knotType == #bezier do append tmpArr k
									)
									4:
									(
										if knotType == #bezierCorner do append tmpArr k
									)
								)
							)
							setKnotSelection o ss tmpArr keep:true
						)
					)					
				)				
			)
		)
	)
	createdialog rol_selKnotsByType width:200	
)
EricRLA's picture

Perfect! Exactly what I was

Perfect! Exactly what I was looking for. Thanks a lot!

Comment viewing options

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