Beispiel #1
0
        /// <summary>
        /// Constructs a Rhino_DotNet OnBrep that is a copy of a given brep.
        /// </summary>
        /// <param name="source">A source brep.</param>
        /// <returns>
        /// Rhino_DotNet object on success. This will be an independent copy.
        /// </returns>
        /// <since>5.0</since>
        public static object ToOnBrep(Geometry.Brep source)
        {
            object rc = null;
            IntPtr const_ptr_source = source.ConstPointer();
            Type   on_brep_type     = GetRhinoDotNetType("RMA.OpenNURBS.OnBrep");

            if (IntPtr.Zero != const_ptr_source && null != on_brep_type)
            {
                System.Reflection.MethodInfo mi = on_brep_type.GetMethod("WrapNativePointer", new[] { typeof(IntPtr), typeof(bool), typeof(bool) });
                IntPtr ptr_new_brep             = UnsafeNativeMethods.ON_Brep_New(const_ptr_source);
                rc = mi.Invoke(null, new object[] { ptr_new_brep, false, true });
            }
            return(rc);
        }