Beispiel #1
0
        /// <summary>
        /// Constructs a Rhino_DotNet OnSurface that is a copy of a given curve.
        /// </summary>
        /// <param name="source">A source brep.</param>
        /// <returns>
        /// Rhino_DotNet object on success. This will be an independent copy.
        /// </returns>
        public static object ToOnSurface(Rhino.Geometry.Surface source)
        {
            object rc      = null;
            IntPtr pSource = source.ConstPointer();
            Type   onType  = GetRhinoDotNetType("RMA.OpenNURBS.OnSurface");

            if (IntPtr.Zero != pSource && null != onType)
            {
                System.Reflection.MethodInfo mi = onType.GetMethod("WrapNativePointer", new Type[] { typeof(IntPtr), typeof(bool), typeof(bool) });
                IntPtr pNewSurface = UnsafeNativeMethods.ON_Surface_DuplicateSurface(pSource);
                rc = mi.Invoke(null, new object[] { pNewSurface, false, true });
            }
            return(rc);
        }