Example #1
0
        /// <summary>
        /// Copies the unmanaged array to a managed counterpart.
        /// </summary>
        /// <returns>The managed array.</returns>
        public GeometryBase[] ToNonConstArray()
        {
            int count = UnsafeNativeMethods.ON_GeometryArray_Count(m_ptr);

            GeometryBase[] rc = new GeometryBase[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr pGeometry = UnsafeNativeMethods.ON_GeometryArray_Get(m_ptr, i);
                rc[i] = GeometryBase.CreateGeometryHelper(pGeometry, null);
            }
            return(rc);
        }
        private static bool CustomGeometryFilter(IntPtr rhObject, IntPtr ptrGeometry, ComponentIndex componentIndex)
        {
            bool rc = true;

            if (g_active_go != null)
            {
                try
                {
                    RhinoObject  rh_object = RhinoObject.CreateRhinoObjectHelper(rhObject);
                    GeometryBase geom      = GeometryBase.CreateGeometryHelper(ptrGeometry, rh_object);
                    rc = g_active_go.CustomGeometryFilter(rh_object, geom, componentIndex);
                }
                catch (Exception ex)
                {
                    Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }
        private static bool CustomGeometryFilter(IntPtr rhObject, IntPtr geometry, ComponentIndex componentIndex)
        {
            bool rc = true;

            if (m_active_go != null)
            {
                try
                {
                    DocObjects.RhinoObject _rhObj = DocObjects.RhinoObject.CreateRhinoObjectHelper(rhObject);
                    GeometryBase           _geom  = GeometryBase.CreateGeometryHelper(geometry, _rhObj);
                    rc = m_active_go.CustomGeometryFilter(_rhObj, _geom, componentIndex);
                }
                catch (Exception ex)
                {
                    Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }
Example #4
0
        /// <summary>
        /// Copies the unmanaged array to a managed counterpart.
        /// </summary>
        /// <returns>The managed array.</returns>
        public Curve[] ToNonConstArray()
        {
            int count = UnsafeNativeMethods.ON_CurveArray_Count(m_ptr);

            if (count < 1)
            {
                return(new Curve[0]);
            }
            Curve[] rc = new Curve[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr curve = UnsafeNativeMethods.ON_CurveArray_Get(m_ptr, i);
                if (IntPtr.Zero == curve)
                {
                    continue;
                }
                rc[i] = GeometryBase.CreateGeometryHelper(curve, null) as Curve;
            }
            return(rc);
        }
Example #5
0
        /// <summary>
        /// Copies the unmanaged array to a managed counterpart.
        /// Elements are made non-const.
        /// </summary>
        /// <returns>The managed array.</returns>
        public Surface[] ToNonConstArray()
        {
            int count = UnsafeNativeMethods.ON_SurfaceArray_Count(m_ptr);

            if (count < 1)
            {
                return(new Surface[0]);
            }
            Surface[] rc = new Surface[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr surface = UnsafeNativeMethods.ON_SurfaceArray_Get(m_ptr, i);
                if (IntPtr.Zero == surface)
                {
                    continue;
                }
                rc[i] = GeometryBase.CreateGeometryHelper(surface, null) as Surface;
            }
            return(rc);
        }