/// <summary> /// Adds an object space modifier to provided node (by handle). /// </summary> /// <param name="nodeHandle"> Input the node handle to add the modifier to. </param> /// <param name="cid"> Input the class id of the modifier add. </param> /// <returns> Returns 1 if successful or -1 if not. </returns> static public 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); }