[Closed] An old question
I want to write the plugin entirely in c#, and a lot of the functions are for spline shape. But line can’t turns into spline shape. Experts, how do you operate line. I feel line is an independent freak. Is there any way to deal with it. Thank you very much!
According to sdk docs line derives from SimpleSpline, so in theory you should be able to cast/convert to it. In c# you can’t be sure whether it will work or not
SimpleSpline – This is a class used in the creation of shape plugins. Most of the 3ds Max shapes and splines are derived from this class. For example, Line, Arc, Circle, Ellipse and Star are all SimpleSplines. This class is defined in \MAXSDK\INCLUDE\SIMPSPL.H.
Yes, I also see these explanations, but I get an error when I try to cast it to convert .
ISimpleSpline spl = (ISimpleSpline)obj ;
try to convert it using CustomMarshalerSimpleSpline from autodesk.max.wrappers.dll I believe there should be examples of how to use it
Serejah, You are my savior, I have been suffering for a long time, OK, I will read it carefully, if there is anything I don’t understand, I will report back. Thank you again
ICustomMarshaler marshaler = Autodesk.Max.Wrappers.CustomMarshalerSplineShape.GetInstance(“what goes there?”);
System.IntPtr ptr = marshaler.MarshalManagedToNative(obj);
object sobj = Marshal.GetObjectForNativeVariant(ptr);
oldNode.ObjectRef = (IObject)sobj;
There still seems to be no way to convert Line to Spline Shape .
no-no, you have to use NativePointer to cast from native to managed.
check out these threads for more info
https://forums.autodesk.com/t5/forums/searchpage/tab/message?advanced=false&allow_punctuation=false&filter=location&location=forum-board:area-b35&q=MarshalNativeToManaged