public static int AddOsmModifier(uint nodeHandle, IClass_ID cid)
{
try
{
IGlobal global = Autodesk.Max.GlobalInterface.Instance;
IInterface14 ip = global.COREInterface14;
IINode node = ip.GetINodeByHandle(nodeHandle);
IObject obj = node.ObjectRef;
IIDerivedObject dobj = global.CreateDerivedObject(obj);
object objMod = ip.CreateInstance(SClass_ID.Osm, cid as IClass_ID);
IModifier mod = (IModifier)objMod;
dobj.AddModifier(mod, null, 0); // top of stack
node.ObjectRef = dobj;
}
catch (Exception ex)
{
Debug.Print(ex.Message);
return -1;
}
return 1;
}