Noobie question about creating objects

 
 
 
Posted by:RizhiK
Data created:24 February 2011

Hi.

I'm new to this package.

Could you please explain, how do I create a cylinder for example.

 

Here you go:

 IGlobal global = Autodesk.Max.GlobalInterface.Instance;

IGeomObject newCylinder = (IGeomObject)global.COREInterface.CreateInstance(SClass_ID.Geomobject, global.Class_ID.Create(0x0012, 0));

//cylinder radius

newCylinder.ParamBlock.SetValue(0, 0, 11.24f);

//cylinder height

newCylinder.ParamBlock.SetValue(1, 0, 19.39f);

 

//cylinder heightSegments

newCylinder.ParamBlock.SetValue(2, 0, 2);

 

//cylinder cap Segments

newCylinder.ParamBlock.SetValue(3, 0, 4);

 

 

IINode mynode = global.COREInterface.CreateObjectNode(newCylinder);

mynode.Name = "Your cylinder";

//-----------------------------------------------------------------------------------------------------

You won't find much documentation for the classes/functions used on this website; in fact most of it is in the 3ds max SDK help so keep it at hand for reference. And understanding the SDK reference is a big pain if you don't have a solid programming foundation. In case you not sure what classes and interfaces are better read up on that first else you won't understand whats happening. Knowledge of C++ is also required because that's the language used in the SDK reference.

Here is the same cylinder in one line of MAXScript:

cylinder radius: 11.24 height: 19.39 hsegs: 2 capsegs: 4 name: "Your cylinder"

 

Hi.
Maybe. It is low question. But....
How do you set up any object position???
What I realy mean it is that move or rotate???
Thanks 

You need to have access to IINode for the object. Then you can use Get/SetNodeTM to alter the transform matrix for that node. You can set position and rotation for the Matrix3 transformation matrix object.

Marsel Khadiyev (Software Developer, EPHERE Inc.)