Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

spring [-addSprings] [-allPoints boolean] [-count] [-damping float] [-dampingPS float] [-endForceWeight float] [-exclusive boolean] [-length float] [-maxDistance float] [-minDistance float] [-minMax boolean] [-name string] [-noDuplicate boolean] [-restLength float] [-restLengthPS float] [-startForceWeight float] [-stiffness float] [-stiffnessPS float] [-useDampingPS boolean] [-useRestLengthPS boolean] [-useStiffnessPS boolean] [-walkLength uint] [-wireframe boolean] objects

spring is undoable, queryable, and editable.

The spring command can do any of the following:

* create a new spring object (shape plus transform). The shape contains springs between the points (particles, cvs, etc.) of the objects selected or listed on the command line.

* create new springs and add them to an existing spring object

* edit or query certain attributes of an existing spring object

One "spring object" may have hundreds or even thousands of individual springs. Certain attributes of the spring object specify exactly where the springs are attached to which other objects.

Springs may be attached to the following: particles, vertices of soft bodies, CVs or edit points of curves or surfaces, vertices of polygonal objects, and points of lattices. In the case where one endpoint of a spring is non-dynamic (a CV, edit point, etc.), the spring does not affect its motion, but the motion of the point affects the spring. A spring will be created only if at least one of the endpoints is dynamic: for example, a spring will never be created between two CVs. A single spring object can hold springs which are incident to any number of other objects.

The spring has creation-only flags and editable flags. Creation-only flags (minDistance, maxDistance, add, exclusive, all, wireframe, walklength, checkExisting) can be used only when creating new springs (including adding springs to existing spring object). Editable flags modify attributes of an existing spring object.

If a spring object is created, this command returns the names of the shape and transform. If a spring object is queried, the command returns the results of the query.

Return value

string

In query mode, return type is based on queried flag.

Flags

addSprings, allPoints, count, damping, dampingPS, endForceWeight, exclusive, length, maxDistance, minDistance, minMax, name, noDuplicate, restLength, restLengthPS, startForceWeight, stiffness, stiffnessPS, useDampingPS, useRestLengthPS, useStiffnessPS, walkLength, wireframe
Long name (short name) Argument types Properties
-name(-n) string createquery
Name of spring object.
-minMax(-mm) boolean create
If True, sets the mode of the spring application to Min/Max. This will add springs between all points from the specified point groups that are between the minimum and maximum distance values set with min and max. (Default is False.) Note: This gets automatically set if either the min or max flags are used.
-wireframe(-wf) boolean create
If True, sets the mode of the spring application to Wireframe. This is valid only for springs created on a soft body. It will add springs along all edges connecting the adjacent points (vertices or CV's) of curves and surfaces. (Default is False.)
-walkLength(-wl) uint create
This flag is valid only when doing wireframe creation. It will create springs between pairs of points connected by the specified number of edges. For example, if walk length is 2, each pair of points separated by no more than 2 edges will get a spring. Walk length measures the distance between pairs of vertices just like the number of blocks measures the distance between two intersections in a city.
-allPoints(-all) boolean createedit
If True, sets the mode of spring application to All. This will add springs between all points selected. (Default is False.)
-addSprings(-add) create
If specified, springs will be added to the existing selected set of springs. (Default is to create a new spring object.)
-exclusive(-exc) boolean create
If true, tells the command to create springs only between pairs of points which are not in the same object. (Default is False.)
-minDistance(-mnd) float create
Minimum distance between two points that a spring would be considered. (Default = 0.0. See Defaults for more information on this flag's default.)
-maxDistance(-mxd) float createedit
Maximum distance between two points that a spring would be considered.
-stiffness(-s) float createqueryedit
Stiffness of the springs created in the spring object. (Default = 1.0 ) -damp float Vestigial form of "damping." Please use "damping" instead.
-damping(-d) float createqueryedit
Damping factor for the springs created in the spring object. (Default = 0.2 )
-length(-l) float createqueryedit
Vestigial form of "restLength." Please use "restLength" instead.
-restLength(-rl) float createqueryedit
Per-object rest length for the new springs. Springs can use either their per-object or per-spring rest length. See the -lPS and -ulp flags.
-stiffnessPS(-sPS) float createqueryedit
Stiffness of the springs created in the spring object. This will initialize all the entries in stiffnessPS to the specified value. In both the flag and the attribute name, "PS" stands for "per-spring." (Default = 1.0 )
-dampingPS(-dPS) float createqueryedit
Damping factor for the springs created in the spring object. This will initialize all the entries in dampingPS to the specified value. In both the flag and the attribute name, "PS" stands for "per-spring." (Default = 0.2 )
-restLengthPS(-rPS) float createqueryedit
Per-spring rest length for the new springs. This will initialize all the entries in restLengthPS to the specified value. If this flag is not thrown, each rest length will be initialized to the distance between the two points at the time the spring is created (i.e., the initial length of the spring). When playing back, springs can use either their per-spring or per-object rest length. See the -rl and -urp flags. In both the flag and the attribute name, "PS" stands for "per-spring."
-useStiffnessPS(-usp) boolean createqueryedit
Specifies whether to use stiffnessPS (per spring stiffness). If set to false, the per object stiffness attribute value will be used. This flag simply sets the useStiffnessPS attribute of the spring shape. In both the flag and the attribute name, "PS" stands for "per-spring." (Default = false )
-useDampingPS(-udp) boolean createqueryedit
Specifies whether to use dampingPS (per spring damping). If set to false, the per object damping attribute value will be used. This flag simply sets the useDampingPS attribute of the spring shape. In both the flag and the attribute name, "PS" stands for "per-spring." (Default = false )
-useRestLengthPS(-urp) boolean createqueryedit
Specifies whether to use restLengthPS (per spring restLength). If set to false, the per object restLength attribute value will be used. This flag simply sets the useRestLengthPS attribute of the spring shape. In both the flag and the attribute name, "PS" stands for "per-spring." (Default = false )
-startForceWeight(-sfw) float createqueryedit
Amount of the force of the spring that gets applied to the point from which the spring starts. Valid range is from 0.0 to 1.0. (Default = 1.0 )
-endForceWeight(-efw) float createqueryedit
Amount of the force of the spring that gets applied to the point to which the spring ends. Valid range is from 0.0 to 1.0. (Default = 1.0 )
-count(-ct) query
Return the number of springs in the shape. Query-only. We maintain this flag only for compatibility with earlier versions of Maya. To get the count of springs, it is much faster and simpler to use the spring shape's count attribute: getAttr <shapeName>.count.
-noDuplicate(-nd) boolean create
Check for existing springs and don't add a new spring between two points already connected by a spring in the same object. Only the object the command is working on is checked. This flag is relevant only when using -add. (Default = false)

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

spring -s 1.5 -d .3 -mnd 0 -mxd 5 -n spring1 particle1;
// Creates a spring object named spring1 with a strength of 1.5 and a
// damping factor of 0.3 containing a spring between every pair of points in
// particle1 that are within 0.0 and 5.0 units apart (except those already
// connected by a spring).
spring -add  -mnd 0 -mxd 5 particle1 spring1;
// Creates between every pair of points in particle1 that are within 0.0
// and 5.0 units apart (except those already connected by a spring), and adds
// them to the existing spring object spring1.
spring -add  -mnd 0 -mxd 5 -ce false particle1 spring1;
// Same as the previous example, but will not check for existing springs
// in order to avoid duplication, and will create a new spring even between
// pairs of particles which already have one.
spring -exclusive true -all true particle1 particle2;
// Creates a spring between every pair of particles such that one
// particle is in particle1 and the other is in particle2.  Does not create
// any springs between pairs in the same object.  Does not create springs
// between particles already connected by a spring.