Пример #1
0
        /// <summary>
        /// Get view dependent dimension scale
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="dimstyle"></param>
        /// <param name="vport"></param>
        /// <returns></returns>
        /// <since>6.0</since>
        public static double GetDimensionScale(RhinoDoc doc, DimensionStyle dimstyle, Rhino.Display.RhinoViewport vport)
        {
            uint   docsn     = doc.RuntimeSerialNumber;
            IntPtr pvport    = vport.ConstPointer();
            IntPtr pdimstyle = dimstyle.ConstPointer();
            double scale     = UnsafeNativeMethods.ON_V6_Annotation_GetDimScale(docsn, pdimstyle, pvport);

            GC.KeepAlive(vport);    // GC_KeepAlive: Nov. 1, 2018
            GC.KeepAlive(dimstyle); // GC_KeepAlive: Nov. 1, 2018
            return(scale);
        }
Пример #2
0
        /// <summary>
        /// Convert a Rhino.Display.Viewport to an RMA.Rhino.IRhinoViewport.
        /// </summary>
        /// <param name="source">A RhinoCommon viewport.</param>
        /// <returns>
        /// Rhino_DotNet IRhinoViewport object on success. This will be an independent copy.
        /// </returns>
        public static object ToIRhinoViewport(Rhino.Display.RhinoViewport source)
        {
            object rc      = null;
            IntPtr pSource = source.ConstPointer();
            Type   rhType  = GetRhinoDotNetType("RMA.Rhino.MRhinoViewport");

            if (IntPtr.Zero != pSource && null != rhType)
            {
                System.Reflection.MethodInfo mi = rhType.GetMethod("WrapNativePointer", new Type[] { typeof(IntPtr), typeof(bool), typeof(bool) });
                const bool isConst  = true;
                const bool doDelete = false;
                rc = mi.Invoke(null, new object[] { pSource, isConst, doDelete });
            }
            return(rc);
        }
Пример #3
0
        public bool CommitViewportChanges()
        {
            bool rc = false;

            if (m_viewport != null)
            {
                IntPtr pThis         = ConstPointer();
                IntPtr pViewport     = m_viewport.ConstPointer();
                uint   serial_number = UnsafeNativeMethods.CRhinoDetailViewObject_CommitViewportChanges(pThis, pViewport);
                if (serial_number > 0)
                {
                    rc = true;
                    m_rhinoobject_serial_number = serial_number;
                    m_viewport.OnDetailCommit();
                }
            }
            return(rc);
        }