extend spline

hello

"with help" of Miauu "I made" a script to add a new knot at the end of a splineshape so I can extend my line. ( as you should use shift drag on a poly edge to extend the poly )
It works fine, but just with a splineshape with ONE spline.
-------------------------------
(
new_spline = $
selKnotsArr = getKnotSelection new_spline 1
-- check if only one knot is selected
if selKnotsArr.count == 1 do
(
skp = getKnotPoint new_spline 1 selKnotsArr[1]
aaa = addKnot new_spline 1 #corner #curve skp
updateshape new_spline
setKnotSelection new_spline 1 #(aaa)
)
)
-------------------------------------
I want it to work even with multiple splines...

How can I get spline index of selected knot ?

Thanks

Comments

Comment viewing options

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

Thanks a lot ! works fine

Thanks a lot ! works fine !!!! :-)
( I understand the logic but I never be able to script that... )

pixamoon's picture

`

try this one:

to get number of spline in shape: numSplines new_spline
and than just replace 1 to index (here is s)

(
new_spline = $
for s = 1 to (numSplines new_spline) do (
	selKnotsArr = getKnotSelection new_spline s
	-- check if only one knot is selected
	if selKnotsArr.count == 1 do
	(
		skp = getKnotPoint new_spline s selKnotsArr[1]
		aaa = addKnot new_spline s #corner #curve skp
		updateshape new_spline
		setKnotSelection new_spline s #(aaa)
	)
)
)

cheers,
Pixamoon

Comment viewing options

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