[Closed] Adding Knots and Change Handlers
I’m trying to add Knots to an existing Spline, then after that create a Change Handler to Monitor when the Knots Move or are changed.
However, I think it’s either the way I’m adding Knots, or the handler is called too soon, because after I create the knots and try to move one, max just stalls/freezes and I have to force close it.
Also, how can I get Knots spaced evenly? I tried just doing 100/numKnots or even CurveLength /numKnots, but neither space out properly?
--Remove all Knots but End ones, so we can add in evenly placed new Knots
while ((numKnots $tT_curveEdges) > 2) do deleteKnot $tT_curveEdges 1 2
updateShape $tT_curveEdges
--Add in Konts to specified count
local tempSpline = copy $tT_curveEdges
local avgPos = (100/(Knots + 1)) * .01
for i = 1 to knots by 1 do
(
closestPoint3OnSpline = pathInterp tempSpline 1 (i * avgPos)
addKnot $tT_curveEdges 1 #smooth #curve closestPoint3OnSpline [0,0,0] [0,0,0] (numKnots $tT_curveEdges)
)
delete tempSpline
updateShape $tT_curveEdges
Also, how can I get Knots spaced evenly?
I hit the same problem with my Super Poly Bridge script.
What I’ve done to solve the problem is – create new spline with desired number of knots and then use lengthInterp to align the new spline to original spline. Then delete the original spline and use the new spline.
^
Cool, thanks! I’ll have to give that a shot tomorrow. I found out my Handler was crashing because I needed to remove it before doing a certain operation I added. So now that’s all good.