splineShape  superclass: Shape; supersuperclass:Node  classID: #(10, 0)
SplineShapes are the general editable versions of all the shape objects, in the same way that Editable Meshes relate to geometry objects. They are the objects that a shape is converted to when you apply an Edit Spline modifier and the result of collapsing a modifier stack on a shape base object. MAXScript lets you construct SplineShapes from scratch, adding individual curves and controls points or you can modify an existing shape by converting it to a SplineShape and using the methods listed below.
See also
Shape Common Properties, Operators, and Methods
Spline Shape Common Properties, Operators, and Methods
Node Common Properties, Operators, and Methods
MAXWrapper Common Properties, Operators, and Methods
Value Common Properties, Operators, and Methods
Class and Object Inspector Functions
Scripting Vertex and Control Point Animation
?
Notes
You must convert existing shapes to SplineShapes in order to operate on them with the these methods. Use the convertToSplineShape() function to do this.
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.
The in and out vectors for Bezier control points are given as vector handle coordinates, not as true vectors as the names suggests.
Coordinates are given in the MAXScript working coordinate system  this is important to note if you are familiar with the corresponding SDK spline functions which always work in objectlocal coordinates.
If the updateShape() function is called on an object that is selected and currently open in the Modify panel, it will drop the current selection in order to avoid a potential crash in 3ds Max, which at the moment, does not support scripted changes to an object open in the Modify panel.
If you are creating or modifying a spline object, and have not yet run updateShape() on the spline, 3ds Max will crash if you minimize and then maximize the 3ds Max window. This is because an only partially created spline is created, and the internal 3ds Max spline structure is left in an unstable state.
Properties
Controls the Interpolation Steps in the Interpolation rollout.
Controls the state of the Optimize checkbox in the Interpolation rollout.
Controls the state of the Adaptive checkbox in the Interpolation rollout.
Toggles the "Enable in Renderer" checkbox on and off. Available in 3ds Max 8 and higher.
Replaces the previously available .renderable property which used to collide with the nodelevel .renderable property. While the alias is still available for compatibility reasons, it is advisable to use the new name in new scripts.
Toggles the "Enable In Viewport" checkbox on and off. When set to true, the mesh will be displayed in the viewports. Available in 3ds Max 8 and higher.
Replaces the previously available .displayRenderMesh property, provides an alias for backwards compatibility.
Toggles the "Use Viewport Settings" checkbox on and off. When set to true, the mesh displayed in the viewport will use the Viewport settings. When false, the Renderer settings will be used for the viewport mesh, too. Available in 3ds Max 8 and higher.
Replaces the previously available .useViewportSettings property, provides an alias for backwards compatibility.
Toggles mapping coordinates generation on and off. The U coordinate wraps once around the thickness of the spline; the V coordinate is mapped once along the length of the spline. Available in 3ds Max 8 and higher.
Replaces the previously available .mapcoords property, provides an alias for backwards compatibility.
Toggles the realworld map size option on and off. Available in 3ds Max 8 and higher.
Toggles the state of the Viewport/Renderer radio buttons. When set to true, the Renderer settings will be displayed in the rollout. When false, the Viewport settings will be shown instead. Available in 3ds Max 8 and higher.
Replaces the previously available .displayRenderSettings property, provides an alias for backwards compatibility.
When set to true, enables the Rectangular crosssection mode to be used in the renderer. When false (default), enables the Radial crosssection mode. Corresponds to the Radial/Rectangular radio buttons in the UI in Renderer mode. Available in 3ds Max 8 and higher.
When set to true, enables the Rectangular crosssection mode to be used in the viewports. When false (default), enables the Radial crosssection mode. Corresponds to the Radial/Rectangular radio buttons in the UI in Viewport mode. Available in 3ds Max 8 and higher.
Get/Set the diameter of the Radial renderable spline mesh. Available in 3ds Max 8 and higher.
Replaces the previously available .thickness property, provides an alias for backwards compatibility.
Get/Set the number of sides for the spline mesh in the renderer. A value of 4 will give you a square cross section, for example. Available in 3ds Max 8 and higher.
Replaces the previously available .sides property, provides an alias for backwards compatibility.
Get/Set the rotational position of the Radial crosssection in the renderer. Available in 3ds Max 8 and higher.
Replaces the previously available .angle property, provides an alias for backwards compatibility.
Get/Set the length of the Rectangular renderable spline mesh. Available in 3ds Max 8 and higher.
Get/Set the width of the Rectangular renderable spline mesh. Available in 3ds Max 8 and higher.
Get/Set rotational position of the Radial crosssection in the renderer. Available in 3ds Max 8 and higher.
Controls the state of the Aspect Lock checkbutton. When set to true, changing the Width will affect the Height and viceversa, preserving the aspect at the time the lock was engaged. Available in 3ds Max 8 and higher.
Get/Set the diameter of the Radial renderable spline mesh in the viewport. Available in 3ds Max 8 and higher.
Replaces the previously available .viewport_thickness property, provides an alias for backwards compatibility.
Gets/Sets the number of sides for the Radial spline mesh in the viewports. A value of 4 will give you a square cross section, for example. Available in 3ds Max 8 and higher.
Replaces the previously available .viewport_sides property, provides an alias for backwards compatibility.
Gets/Sets the rotational position of the crosssection in the viewports. Available in 3ds Max 8 and higher.
Replaces the previously available .viewport_angle property, provides an alias for backwards compatibility.
Get/Set the length of the Rectangular spline mesh in the viewports. Available in 3ds Max 8 and higher.
Get/Set the width of the Rectangular spline mesh in the viewports. Available in 3ds Max 8 and higher.
Get/Set rotational position of the Rectangular crosssection in the viewports. Available in 3ds Max 8 and higher.
Controls the state of the Aspect Lock checkbutton. When set to true, changing the Width will affect the Height and viceversa, preserving the aspect at the time the lock was engaged. Available in 3ds Max 8 and higher.
Controls the state of the Auto Smooth checkbox. When set to true, auto smoothing will be enabled. Available in 3ds Max 8 and higher.
Get/set the Auto Smooth Threshold value. Available in 3ds Max 8 and higher.
?
Up to 3*N vertex and tangent coordinates are available as properties, where N is the number of vertices in the SplineShape. A vertex and its tangents are available as properties once a controller has been assigned to the vertex. Controllers can be assigned to vertices using the animateVertex() method described in Scripting Vertex and Control Point Animation. For example, if a circle object is collapsed to a SplineShape, and some of its vertices are animated, the properties for the vertices and tangents would be similar to:
$Circle01.Spline_1___InVec_1 Point3 value: [75,33,0]  animatable
$Circle01.Spline_1___Vertex_1 Point3 value: [75,33,0]  animatable
$Circle01.Spline_1___OutVec_1 Point3 value: [50,0,0]  animatable
$Circle01.Spline_1___InVec_2 Point3 value: [20,33,0]  animatable
$Circle01.Spline_1___Vertex_2 Point3 value: [7,66,0]  animatable
$Circle01.Spline_1___OutVec_2 Point3 value: [32,95,0]  animatable
Methods
updateShape
Updates the shape's internal caches and viewport display to account for all the changes made by other functions in this kit. This update must be done before 3ds Max or any other code tries to work with a modified shape object.
The updateShape() function makes any scripted changes to a base object spline shape propagate into the bottom of any modifier stack that is present. Note that there is no check to warn you that modifications such as topology changes might invalidate modifiers already in the stack. This is equivalent to opening and modifying the base object in a Modify panel, ignoring its warnings about invalidating the object.
resetShape
Clears all the spline curves out of a shape
numSplines
Returns the number of
spline curves in the shape as an integer. Equivalent to
setFirstSpline
Rolls the order of the splines in a shape around so that the numbered spline is the first spline in the shape. This is useful when working with multispline shapes in the Lofter and some other modifiers such as Surface Tools which are sensitive to spline order.
hideselectedsplines
Hides the selected splines in the shape.
hideselectedsegments
Hides the selected segments in the shape.
hideselectedverts
Hides the segments attached to the selected knots in the shape.
unhidesegments
Unhides all segments in the shape.
addAndWeld
Add the splines from one spline shape to the specified bezier shape. The weld threshold will weld the endpoints of the new splines onto endpoints of existing ones if they are within the distance specified.
bindKnot
Binds
the first or end knot of a spline to the midpoint of the specified
segment. A bind acts as a constraint, it constrains the first point
or the end point of a spline to the mid point of a segment.
If
unBindKnot
Unbinds the specified end/first knot of the given spline
updateBindList
Called when the topology changes to update the bind list, for example when knots are deleted from bound spline or the spline bound to.
materialID
Returns the material id for the given segment of the given shape object.
animateVertex
<shape>
Applies controllers to the
specified vertices and tangents of the splineshape, where
#all
By assigning controllers to the vertices and tangents, the vertices and tangents are added to the Master subAnim and appear as animatables in the Track View, allowing further scripting of the vertices and tangents.
For example,
animateVertex $Circle01 #all
The vertices to be animated are specified by index number or with the keyword #all to animate all vertices.
See also Class and Object Inspector Functions and Scripting Vertex and Control Point Animation for details on accessing the splineshape vertices and tangents. The controller values assigned to the vertices and tangent handles is in object space. See Using Node Transform Properties for information on converting between world space to object space.
addNewSpline
Adds a new spline curve to the spline shape and returns an integer reflecting the spline index of the newly added spline curve. Individual spline curves are given index numbers starting at 1. The addNewSpline() function adds new spline curves to the end of the list of curves in a shape.
getSplineSelection
Returns the indices of the selected splines in the shape as an array of integers.
setSplineSelection
Selects the splines
specified by
deleteSpline
Deletes the indexed spline curve from the shape. The remaining curves are renumbered to account for the deletion.
numSegments
Returns the number of line segments in the indexed spline as an integer. This is the same as the number of knots for closed splines and 1 less for open splines.
numKnots
Returns the number of knots (also known vertices or control points) in the indexed spline as an integer. If the spline index is not specified, returns the number of knots in the entire shape.
isClosed
returns true if the indexed spline is closed, false if it is open.
close
closes the indexed spline.
open
opens the indexed spline between its last and first knots.
reverse
reverses the order of the knots in the indexed spline.
setFirstKnot
rolls the order of the knots in the indexed spline around so that the specified knot becomes the first knot in the spline.
getSegLengths
[byVertex:
Returns array of segment lengths or vertex distances by spline fraction and length, and total spline length. Double precision calculations, very accurate. If cum:true, results are cumulative, otherwise they are relative. If byVertex:true results are per vertex, otherwise per segment.
Defaults: cum:false byVertex:false numArcSteps:100
subdivideSegment
Divides the segment into the specified number of divisions. Double precision calculations, very accurate.
interpCurve3D
Returns a
tangentCurve3D
Returns a
getSegmentType
Gets the segment type of the indexed segment in the indexed spline
setSegmentType
( #curve  #line )
Sets the segment type of the indexed segment in the indexed spline
Adds a new knot to the indexed segment of the indexed curve at a place along the indexed segment corresponding to the given segment interpolation parameter. This value is a float in the range 0.0 to 1.0, specifying a proportion along the segment. The new knot coordinates and invector and outvector are automatically computed to maintain the segment's existing curvature. This is the primitive used by the refine function in the Edit Spline modifier.
You can use the MAXScript spline path interpolation functions to derive segment parameters given that a curve's path interpolation parameter is divided evenly among the segments in a curve.
Given a path interpolation parameter u in a spline of m segments, the target segment is:
n = (m*u) as integer + 1
and the segment parameter is:
f = (u(n1)/m)*m
which can be refactored to the following which will reduce roundoff error in the calculation:
f = u*mn+1
The refineSegment() function returns the index of the newly inserted knot.
getSegSelection
Returns the indices of the selected segments in the specified shape spline as an array of integers.
setSegSelection
[
keep:
Selects the segments
specified by
setMaterialID
Sets the material ID of the specified spline segment.
getMaterialID
Gets the material ID of the specified spline segment.
addKnot
( #smooth  #corner  #bezier  #bezierCorner ) \
(
#curve

#line
)
[invec_point3 outvec_point3] \
[where_integer]
Adds a new knot (control point) to the indexed spline and returns an integer reflecting the index of the newly added knot. The 3^{rd} argument specifies the type of the knot, the 4^{th} specifies the type of the segment leaving the knot. The 5^{th} specifies the coordinates for the new point (given in the current working coordinate system). If the knot type is bezier or bezierCorner, you must give the invector and outvector handle coordinates as the 6^{th} and 7^{th} arguments. In the same way as splines are indexed in a shape, knots are indexed in a spline. The optional last argument lets you specify where in the knot order the new knot is to be inserted, defaulting to the end of the spline if you leave this argument off.
deleteKnot
Deletes the indexed knot in the indexed spline. The remaining knots are renumbered to account for the deletion.
getKnotType
Returns the knot type of the indexed knot in the indexed spline. The value is one of the names #smooth, #corner, #bezier, or #bezierCorner.
setKnotType
(#smooth  #corner  #bezier  #bezierCorner )
Sets the knot type of the indexed knot in the indexed spline. This is equivalent to the rightmousebutton change you can make to spline controlpoints using the Edit Spline modifier in 3ds Max.
getKnotPoint
Retrieves the coordinates of the indexed knot as a point3 in the current working coordinate system.
setKnotPoint
Sets the coordinates of the indexed knot in the indexed spline. Coordinates are given in the current working coordinate system.
getInVec
Retrieves the coordinates of the invector handle for the indexed knot as a point3 in the current working coordinate system.
setInVec
Sets the coordinates of the invector handle of the indexed knot. Coordinates are given in the current working coordinate system.
getOutVec
Retrieves the coordinates of the outvector handle for the indexed knot as a point3 in the current working coordinate system.
setOutVec
Sets the coordinates of the outvector handle of the indexed knot. Coordinates are given in the current working coordinate system.
getKnotSelection
Returns the indices of the selected knots in the specified shape spline as an array of integers.
setKnotSelection
Selects the knots
specified by
See also
Editable Spline Modify Panel Command Modes and Operations
How To ... Flatten a SplineShape
How To ... Draw a Freehand Spline
?