ScriptSpot

Forum topic · General Scripting

How to assign hotkey for these commands? (vertices properties in spline)

By nnq2603 · 2016-12-20

Description

These command list below in this image. Spline \ corner, bezier, smooth, etc... Haven't figure out to assign hotkey to any of them. I know rightclick menu is quite fast, but for some tasks in my current work, those command need to execute a lot of time and I prefer hotkey than context menu.

http://i.imgur.com/otfuhmL.gif

And I know how to assign hotkey/shortcut key in 3ds max for other commands. Normal way is rightclick>customize>Keyboard tab, pick the right Category (or Group), then navigate to the wanted command, assign a letter/symbol,key to it. But these vertex command such as corner, bezier... I couldn't find out in entire list of commands in 3ds max. They must be somewhere there but I can't find. Could this issue be solved with a little script or..?

Comments (6)

tahir1983 · 2018-05-26

wonderfull! but if add undo it will be excellently!

.

jahman · 2018-05-26

you need to modify these macro a little for undo to work


if classOf curO == SplineShape or classOf curO == Line do
		(
			convertToSplineShape curO
			splinesCnt = numSplines curO
...
...

.

miauu · 2016-12-22


macroscript miauuConertSplineKnotsToSmooth
category:"miauu"
tooltip:"Convert Knots to Smooth"
buttonText:"Convert Knots to Smooth"
(
	if selection.count == 1 do
	(
		curO = selection[1]
		if classOf curO == SplineShape or classOf curO == Line do
		(
			splinesCnt = numSplines curO
			for ss = 1 to splinesCnt do
			(
				selKnotsArr = getKnotSelection curO ss
				for k in selKnotsArr do
					setKnotType curO ss k #smooth
			)
			updateShape curO
		)		
	)	
)

macroscript miauuConertSplineKnotsToCorner
category:"miauu"
tooltip:"Convert Knots to Corner"
buttonText:"Convert Knots to Corner"
(
	if selection.count == 1 do
	(
		curO = selection[1]
		if classOf curO == SplineShape or classOf curO == Line do
		(
			splinesCnt = numSplines curO
			for ss = 1 to splinesCnt do
			(
				selKnotsArr = getKnotSelection curO ss
				for k in selKnotsArr do
					setKnotType curO ss k #corner
			)
			updateShape curO
		)		
	)	
)

macroscript miauuConertSplineKnotsToBezier
category:"miauu"
tooltip:"Convert Knots to Bezier"
buttonText:"Convert Knots to Bezier"
(
	if selection.count == 1 do
	(
		curO = selection[1]
		if classOf curO == SplineShape or classOf curO == Line do
		(
			splinesCnt = numSplines curO
			for ss = 1 to splinesCnt do
			(
				selKnotsArr = getKnotSelection curO ss
				for k in selKnotsArr do
					setKnotType curO ss k #bezier
			)
			updateShape curO
		)		
	)	
)

macroscript miauuConertSplineKnotsToBezierCorner
category:"miauu"
tooltip:"Convert Knots to BezierCorner"
buttonText:"Convert Knots to BezierCorner"
(
	if selection.count == 1 do
	(
		curO = selection[1]
		if classOf curO == SplineShape or classOf curO == Line do
		(
			splinesCnt = numSplines curO
			for ss = 1 to splinesCnt do
			(
				selKnotsArr = getKnotSelection curO ss
				for k in selKnotsArr do
					setKnotType curO ss k #bezierCorner
			)
			updateShape curO
		)		
	)	
)

If you don't like the category or the names/tooltips of the macros - change them.

Thanks for detailed answer.

nnq2603 · 2016-12-23

Thanks a lot, miauu. I'll use it and get back later if there's any problem (probably there's not).

Return some errors.

nnq2603 · 2016-12-26

I get this error:


---------------------------
MAXScript MacroScript Error Exception
---------------------------
-- Runtime error: Spline operation on non-spline: Rectangle
---------------------------
OK   
---------------------------

Edit Spline modifier above Rectangle. How to add Edit Spline object to script? (beside spline and line)

.

miauu · 2016-12-26

I can't find how to add support for Editable Spline modifier.