コード例 #1
0
 static CustomObjectGrips FromSerialNumber(int serial_number)
 {
     for (int i = 0; i < m_all_custom_grips.Count; i++)
     {
         CustomObjectGrips grips = m_all_custom_grips[i];
         if (grips.m_runtime_serial_number == serial_number)
         {
             return(grips);
         }
     }
     return(null);
 }
コード例 #2
0
        private static void CRhinoObjectGrips_UpdateMesh(int serial_number, int meshType)
        {
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    grips.OnUpdateMesh((Geometry.MeshType)meshType);
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
        }
コード例 #3
0
        private static void CRhinoObjectGrips_ResetMeshes(int serial_number)
        {
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    grips.OnResetMeshes();
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
        }
コード例 #4
0
        private static void CRhinoObjectGrips_Draw(int serial_number, IntPtr pDrawSettings)
        {
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    GripsDrawEventArgs args = new GripsDrawEventArgs(pDrawSettings);
                    grips.OnDraw(args);
                    args.m_pGripsDrawSettings = IntPtr.Zero; // don't let the args hold onto a pointer
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
        }
コード例 #5
0
        private static IntPtr CRhinoObjectGrips_NurbsSurface(int serial_number)
        {
            IntPtr            rc    = IntPtr.Zero;
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    Pixel.Rhino.Geometry.NurbsSurface ns = grips.NurbsSurface();
                    if (ns != null)
                    {
                        rc = ns.ConstPointer();
                    }
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }
コード例 #6
0
        private static IntPtr CRhinoObjectGrips_NurbsSurfaceGrip(int serial_number, int i, int j)
        {
            IntPtr            rc    = IntPtr.Zero;
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    GripObject grip = grips.NurbsSurfaceGrip(i, j);
                    if (grip != null)
                    {
                        rc = grip.NonConstPointer();
                    }
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }
コード例 #7
0
        private static IntPtr CRhinoObjectGrips_NeighborGrip(int serial_number, int gripIndex, int dr, int ds, int dt, int wrap)
        {
            IntPtr            rc    = IntPtr.Zero;
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    GripObject grip = grips.NeighborGrip(gripIndex, dr, ds, dt, wrap != 0);
                    if (grip != null)
                    {
                        rc = grip.NonConstPointer();
                    }
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }
コード例 #8
0
        private static IntPtr CRhinoObjectGrips_NewGeometry(int serial_number)
        {
            IntPtr            rc    = IntPtr.Zero;
            CustomObjectGrips grips = FromSerialNumber(serial_number);

            if (grips != null)
            {
                try
                {
                    Pixel.Rhino.Geometry.GeometryBase geom = grips.NewGeometry();
                    if (geom != null)
                    {
                        rc = geom.NonConstPointer();
                        geom.ReleaseNonConstPointer();
                    }
                }
                catch (Exception ex)
                {
                    Pixel.Rhino.Runtime.HostUtils.ExceptionReport(ex);
                }
            }
            return(rc);
        }