NURBS Node Properties and Methods

Properties

There are several properties on <node> objects that give access to sub-object selections in NURBS objects:

<node>.selectedCurveCVs

 

<node>.selectedCurves

 

<node>.selectedImports

 

<node>.selectedPoints

 

<node>.selectedSurfaces

 

<node>.selectedSurfCVs

 

<node>.curveCVs

 

<node>.curves

 

<node>.imports

 

<node>.surfaces

 

<node>.surfCVs

 

<node>.points

 

These all return a NURBSSelection Value, and enable sub-object manipulation in a manner similar to that provided for Editable Meshes.

Methods

The following NURBS-related methods operate on scene nodes:

getNURBSSet <node> [#relational]

This function is used to retrieve a NURBSSet that corresponds to the specified NURBS scene node. This allows access the internal objects inside a 3ds Max editable NURBS object.

If the optional #relational parameter is not supplied, the returned NURBSSet will contain only independent curves and surfaces, all dependent objects will be decomposed into corresponding independent objects. So for example, if you pass an object that has a relational model (perhaps two CV surfaces and a dependent blend surface) it will decompose them into three CV surfaces. This will be the CV surfaces that represent the two surfaces and the blend, but you won't have the blend relational data. If the #relational argument is supplied, you get back two CV surfaces and a NURBS blend surface and the NURBSSet is an active representative for the scene object -- any changes you make to the properties of it's constituent NURBSObjects will be reflected directly in the source scene object.

addNURBSSet <node> <nurbsSet>

This function adds the supplied NURBSSet to the specified NURBS scene object, creating subobjects within the scene node corresponding to the definitions in the NURBSSet. After the function call, the supplied NURBSSet becomes an active representative for the new scene node subobjects, all the NURBSId properties are filled-in and you can modify the associated scene sub-object by modifying the properties of the NURBSSet component objects.

transform <node> <nurbsId_or_Id_array> <matrix3>

Transforms the specified sub-objects by the matrix supplied in the node's local space. The sub-objects to be transformed are identified by their NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

breakCurve <node> <nurbsId> <u_param>

Breaks the specified sub-object curve at the parametric point along the curve defined by the <u_param> float argument. The sub-object to be broken is identified by its NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

breakSurface <node> <nurbsId> (#U | #V) <u_or_v_param>

Breaks the specified sub-object surface at the parametric point defined by the <u_or_v_param> argument in the u or v direction depending on whether #U or #V is supplied for the third argument. The sub-object to be broken is identified by its NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

joinCurves <node> <nurbsId1> <nurbsId2> <tolerance_float> [flip1:<boolean>] [flip2:<boolean>]

Joins two curve sub-objects in the specified scene node and makes a single curve out of them. That is, the endpoints of the two curve objects are connected by new segments, and the two original curves are replaced by a single curve.

The supplied tolerance is a distance in 3ds Max units. If the gap between the curves you are joining is greater than this value, this function creates the join by first creating a blend curve and then joining the three parts. If the gap is less than this value, or if the curves are overlapping or coincident, no blend is created.

Creating a blend and then joining the three curves into a single curve is the better technique. The result matches the parent curves well. Without the blend step, the resulting curve can deviate from the parent curves, in order to maintain smoothness. (The amount of deviation depends on how far from tangent the two input curves were at the join.)

A problem arises when there is a gap but it is too small. In this case, this function generates the blend but because there isn’t enough room for it, the resulting curve has a loop in it. To avoid this loop, set this parameter higher than the gap distance.

If you the tolerance to 0.0, the function chooses a value to use for the tolerance.

The sub-objects to be joined are identified by their NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

joinSurfaces <node> <nurbsId1> <nurbsId2> <edge1_integer> <edge2_integer> <tolerance_float>

Joins two surface sub-objects in the specified scene node and makes a single surface from them. The specified edges of the two surface objects are connected by a new surface, and the two original surfaces are replaced by a single surface.

The edges are identified by edge index numbers.

The tolerance is a distance in 3ds Max units. If the gap between the surfaces you are joining is greater than this value, this function creates the join by first creating a blend surface. If the gap is less than this value, or if the surfaces are overlapping or coincident, 3ds Max doesn’t create the blend.

Creating a blend and then joining the three surfaces into a single surface is the better technique. The result matches the parent surfaces well. Without the blend step, the resulting surface can deviate from the parent surfaces, in order to maintain smoothness. (The amount of deviation depends on how far from tangent the two input surfaces were at the join.)

A problem arises when there is a gap but it is too small. In this case, this function generates the blend but because there isn’t enough room for it, the resulting surface has a loop in it. To avoid this loop, set the tolerance parameter higher than the gap distance.

If you set the tolerance to 0.0, the function chooses a value to use for the tolerance.

The sub-objects to be joined are identified by their NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

makeIndependent <node> <nurbsId>

This function takes a dependent sub-object (fillet, offset, blend, etc.) and turns it into a CV variant of itself such that it is independent (no longer dependent on a parent).

The sub-object to be made independent is identified by its NURBSId property which is set up when you instantiate a NURBSSet with the NURBSNode() function or if you extract a relational NURBSSet from an existing NURBS scene node using the getNURBSSet() function.

setViewApproximation <node> <surfaceApproximation>

setRenderApproximation <node> <surfaceApproximation>

setSurfaceDisplay <node> <nurbsdisplay>

These methods work NURBS curve and surface scene nodes. They take instances of the NURBSSurfaceApproximation and NURBSDisplay classes and set the display or curve/surface approximation settings of the given NURBS scene node to those specified in the approximation or display control instance.

Associated Methods

canConvertTo <node> <class>

Allows you to test whether a given node is convertible into a given class. Returns true or false. For example:

if canConvertTo $foo NURBSSurface then ...

The kinds of classes you can convert objects to are the generic editable forms including Mesh, SplineShape, NURBSCurve, NURBSSurface, etc.

convertTo <node> <class> -- mapped

This function is a general form of the existing specific conversion functions such as convertToMesh(), convertToSplineShape(), etc. For example, convertToSplineShape() can be written:

convertTo $circle01 SplineShape

If the conversion is not supported, the function returns the value undefined.

convertToNURBSSurface <node> -- mapped

convertToNURBSCurve <node> -- mapped

These functions work on those primitive geometry and shape classes that support conversion to NURBS (such as boxes, spheres, circles, lines, etc.). If an object does not support conversion, the function returns undefined.

isPointSelected <node> <point_index>

Returns true is the specified point is selected, false if not. The definition of a ‘point’ varies depending on the object type. For meshes, it is the mesh vertex. For a spline, it is the knot. For NURBS objects, it is the vertex or control point.

pointSelection <node> <point_index>

Returns a floating point weighted point selection if the object supports it. Most object types just return 1.0 if the point is selected and 0.0 if not. Only NURBS objects currently support weighted point selection.

stopCreating <node>

This method stops the creation of the current object, if any. This method is primarily used to ensure that a NURBS scene objects is fully created, which it will not be until the creation is stopped. The NURBSSet returned for a NURBS scene object will not be complete if the object is still in creation mode. This method will also deactivated any activated object create buttons in the Create panel.