[Closed] Spline creation problem
I’m trying to create a spline for a scripted rig but I’ve ran into a wierd problem.
After I create the spline and try to adjust a vertex in the viewport Max crashes. However, if I save the file then reopen it, Max says that the file was saved in an obsolete version, but its seems to work fine. Can anyone verify this as a bug? Or hopefully tell me I’m doing it wrong.
Here is an example of how I’m creating the spline:
spline = splineshape()
addnewspline spline
addknot spline 1 #corner #curve [0,0,0]
addknot spline 1 #corner #curve [10,10,10]
Thanks
You are missing the call to the updateShape() method.
See MAXScript Reference > SplineShape:Shape, Notes, 2.
“Only the updateShape() function updates the shape’s internal caches and images in 3ds Max viewports. This is because updates can be computationally expensive and you don’t want them performed on every function call. However, you must make sure you do call the updateShape() function after a series of changes and before the shape is to be worked on in 3ds Max or by other functions in MAXScript.:
Also see the MAXScropt FAQ Example in the Reference “How do I create a line between two points?”[left]
[/left]
[b][color=white][b][/b][/color][/b][left]fn drawLineBetweenTwoPoints pointA pointB =
[/left]
[left](
[/left]
[left]ss = SplineShape pos:pointA
[/left]
[left]addNewSpline ss
[/left]
[left]addKnot ss 1 #corner #line PointA
[/left]
[left]addKnot ss 1 #corner #line PointB
[/left]
[left]updateShape ss
[/left]
[left]ss
[/left]
[left])
[/left]
[left]newSpline = drawLineBetweenTwoPoints [10,20,30] [100,200,10]
[/left]