/// <summary>
        /// Demonstrates using a custom inteop helper class
        /// </summary>
        /// <returns></returns>
        public static Polyline[] MooseGetPolylines()
        {
            var array     = new SimpleArrayPolyline();
            var ptr_array = array.NonConstPointer();

            int count = Environment.Is64BitProcess ?
                        UnsafeNativeMethods64.MoooseGetPolylines(ptr_array) :
                        UnsafeNativeMethods32.MoooseGetPolylines(ptr_array);

            if (count == 0)
            {
                array.Dispose();
                return(new Polyline[0]);
            }

            var list = new List <Polyline>(count);

            for (var i = 0; i < count; i++)
            {
                list.Add(array.Get(i));
            }

            array.Dispose();

            return(list.ToArray());
        }
        /// <summary>
        /// Calls another more complicated, exported function
        /// </summary>
        public static int MooseFunction2(Brep brep, int x, int y, IEnumerable <Point3d> points, out Line[] lines)
        {
            if (null == brep)
            {
                throw new ArgumentNullException("brep");
            }

            // Get the native ON_Brep pointer
            var const_ptr_brep = Interop.NativeGeometryConstPointer(brep);

            var pts     = new List <Point3d>(points);
            var ptarray = pts.ToArray();

            // Creates a ON_SimpleArray<ON_Line> wrapper class instance
            var lines_array = new Rhino.Runtime.InteropWrappers.SimpleArrayLine();
            // Get a non-const point to this class
            var ptr_lines_array = lines_array.NonConstPointer();

            var rc = Environment.Is64BitProcess ?
                     UnsafeNativeMethods64.MooseFunction2(const_ptr_brep, x, y, ptarray.Length, ptarray, ptr_lines_array) :
                     UnsafeNativeMethods32.MooseFunction2(const_ptr_brep, x, y, ptarray.Length, ptarray, ptr_lines_array);

            lines = rc > 0 ? lines_array.ToArray() : new Line[0];
            lines_array.Dispose();

            return(rc);
        }
 /// <summary>
 /// Adds a point to the Rhino document
 /// </summary>
 public static Guid MooseAddPoint(Point3d point)
 {
     if (Environment.Is64BitProcess)
     {
         return(UnsafeNativeMethods64.MooseAddPoint(point));
     }
     else
     {
         return(UnsafeNativeMethods32.MooseAddPoint(point));
     }
 }
 /// <summary>
 /// Sums two numbers
 /// </summary>
 public static double MooseSum(double a, double b)
 {
     if (Environment.Is64BitProcess)
     {
         return(UnsafeNativeMethods64.MooseSum(a, b));
     }
     else
     {
         return(UnsafeNativeMethods32.MooseSum(a, b));
     }
 }
 /// <summary>
 /// Prints a message to the Rhino command line.
 /// </summary>
 public static void MoosePrint(string s)
 {
     if (Environment.Is64BitProcess)
     {
         UnsafeNativeMethods64.MoosePrint(s);
     }
     else
     {
         UnsafeNativeMethods32.MoosePrint(s);
     }
 }
 public static int ON_PolylineArray_Delete(IntPtr ptrArray)
 {
     return(Environment.Is64BitProcess ?
            UnsafeNativeMethods64.ON_PolylineArray_Delete(ptrArray) :
            UnsafeNativeMethods32.ON_PolylineArray_Delete(ptrArray));
 }
 public static int ON_PolylineArray_Get(IntPtr ptrArray, int index, IntPtr ptrPoints)
 {
     return(Environment.Is64BitProcess ?
            UnsafeNativeMethods64.ON_PolylineArray_Get(ptrArray, index, ptrPoints) :
            UnsafeNativeMethods32.ON_PolylineArray_Get(ptrArray, index, ptrPoints));
 }
 public static IntPtr ON_PolylineArray_New()
 {
     return(Environment.Is64BitProcess ?
            UnsafeNativeMethods64.ON_PolylineArray_New() :
            UnsafeNativeMethods32.ON_PolylineArray_New());
 }