Ejemplo n.º 1
0
        /// <summary>
        /// Example function
        /// </summary>
        public static int ExampleFunction(Brep brep, int x, int y, out Point3d[] points, out Line[] lines)
        {
            if (null == brep)
            {
                throw new ArgumentNullException(nameof(brep));
            }

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

            // Creates a ON_3dPointArray wrapper class instance
            var points_array = new Rhino.Runtime.InteropWrappers.SimpleArrayPoint3d();
            // Get a non-const point to this class
            var ptr_points_array = points_array.NonConstPointer();

            // 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 = UnsafeNativeMethods.MooseFunction(const_ptr_brep, x, y, ptr_points_array, ptr_lines_array);

            if (rc > 0)
            {
                points = points_array.ToArray();
                lines  = lines_array.ToArray();
            }
            else
            {
                points = new Point3d[0];
                lines  = new Line[0];
            }

            points_array.Dispose();
            lines_array.Dispose();

            return(rc);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Example function
 /// </summary>
 public static int ExampleFunction(Brep brep, int x, int y, out Point3d[] points, out Line[] lines)
 {
     return(UnsafeNativeMethods.MooseFunction(brep, x, y, out points, out lines));
 }