The NURBS API provides an interface into the NURBS objects used by 3ds Max. Unlike much of the 3ds Max API, the NURBS objects 3ds Max provides don't use this API. Rather, the NURBS API has been added to allow developers to access the NURBS objects 3ds Max uses internally. Using the API developer can create new NURBS objects or modify existing ones.
Developers can check if an object is a NURBS object by checking it ClassID(). If it matches any of the following
#define EDITABLE_SURF_CLASS_ID Class_ID(0x76a11646, 0x12a822fb) #define FITPOINT_PLANE_CLASS_ID Class_ID(0x76a11646, 0xbadbeef) #define EDITABLE_CVCURVE_CLASS_ID Class_ID(0x76a11646, 0x12a82144) #define EDITABLE_FPCURVE_CLASS_ID Class_ID(0x76a11646, 0x12a82142)
then it's a NURBS object and the NURBS API may be used to manipulate it.
The main NURBS include file is \MAXSDK\INCLUDE\SURF_API.H. This is not included by default by MAX.H so you need to specifically include it via the following statement:
#include"surf_api.h"
Developers who wish to understand the mathematics of NURBS should see:
The NURBS Book: Les Piegl, Wayne Tiller, The NURBS Book (Berlin Heidelberg New York: Springer-Verlag, 1995). ISBN: 3-540-55069-0.
An important concept to understand when working with NURBSSets and the other NURBS classes is the way you identify component items that are in the set. Before a NURBSet is instantiated in the scene as a NURBS object, the individual points, curves, and surfaces are identified by an index number. As you append objects to the set they are assigned successive indexes, starting at 0. When you want to refer to a particular item, say to specify the parent surfaces in a blend surface, you use this index. Once an object has been added to a NURBSSet, its index can retrieved using.
However, once a NURBSSet is associated with a scene object, either by being instantiated or because it was directly created from an existing scene object, this index is no longer valid. Instead, a different number, called a NURBSId, is assigned to each item and you must use that Id when referring to items from then on. The NURBSId of any item in an instantiated NURBSSet can be obtained through the NURBSObject::GetId() method of that object.
Some kinds of dependent objects depend on geometry that might have more than one solution. For example, if you want to create a surface-curve intersection point but the curve intersects the surface more than once, 3ds Max must decide which intersection is to be the location of the point.
For these kinds of objects, seed value parameters control the decision. The seed location is a location on a parent object, and the location nearest to the seed value that satisfies the creation condition is the one that 3ds Max chooses.
For example, the seed location for a surface-curve intersection point is a U position along the length of the parent curve. The surface-curve intersection closest to the seed is chosen as the location of the dependent point.
For a surface, the seed location is a pair of UV coordinates in the surface's parameter space.