» Back to Documentation

One of the most trivial operations performed in the SDK is the creation of objects. In Max.NET's managed environment you can create instances of your own defined classes or other managed classes using the new keyword, for example: var myClassInstance = new MyClass();

Creating instances of unmanaged classes defined in C++ SDK, however, is a little less trivial (but not hard).

All exported 3dsmax classes that contain a constructor (explicit or implicit) can be created using IGlobal.ClassName.Create(...) method where IGlobal is the global Max.NET class, ClassName is the name of the class you are trying to instantiate and ... are any constructor parameters for the class (or none if constructor is parameterless).

Here are some examples of creating new instances of 3dsmax objects given an IGlobal instance:

 

IMatrix3 matrix3 = global.Matrix3.Create();
IPoint3 point3 = global.Point3.Create( x, y, z );
IMesh mesh = global.Mesh.Create();
ITab<IINode> nodeTab = global.Tab.Create<IINode>();

 

Note that ITab is a generic class (being a template class in C++) so we must specify the type in its create method as well.