示例#1
0
        internal override IntPtr _InternalGetConstPointer()
        {
            MaterialHolder mh = m__parent as MaterialHolder;

            if (mh != null)
            {
                return(mh.ConstMaterialPointer());
            }
#if RHINO_SDK
            if (m_is_default)
            {
                return(UnsafeNativeMethods.CRhinoMaterial_DefaultMaterial());
            }
            if (m_doc != null)
            {
                return(UnsafeNativeMethods.CRhinoMaterialTable_GetMaterialPointer(m_doc.m_docId, m_id));
            }
#endif
            FileIO.File3dm parent_file = m__parent as FileIO.File3dm;
            if (parent_file != null)
            {
                IntPtr ptr_model = parent_file.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_GetMaterialPointer(ptr_model, m_id));
            }
            return(IntPtr.Zero);
        }
        internal override IntPtr NonConstPointer()
        {
            FileIO.File3dm file_parent = m__parent as FileIO.File3dm;
            if (file_parent != null)
            {
                IntPtr pConstParent = file_parent.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_GetDimStylePointer(pConstParent, m_id));
            }

            return(base.NonConstPointer());
        }
        internal override IntPtr _InternalGetConstPointer()
        {
#if RHINO_SDK
            if (m_doc != null)
            {
                return(UnsafeNativeMethods.CRhinoDimStyleTable_GetDimStylePointer(m_doc.m_docId, m_id));
            }
#endif

            FileIO.File3dm file_parent = m__parent as FileIO.File3dm;
            if (file_parent != null)
            {
                IntPtr pConstParent = file_parent.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_GetDimStylePointer(pConstParent, m_id));
            }
            return(IntPtr.Zero);
        }
        internal IntPtr NonConstPointer()
        {
            FileIO.File3dm parent_file = m_parent as FileIO.File3dm;
            if (parent_file != null)
            {
                IntPtr ptr_const_parent_file = parent_file.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_ViewPointer(ptr_const_parent_file, m_id, m_ptr, m_named_view_table));
            }

            if (m_ptr == IntPtr.Zero)
            {
                IntPtr ptr_const_this = ConstPointer();
                m_ptr = UnsafeNativeMethods.ON_3dmView_New(ptr_const_this);
#if RHINO_SDK
                m_index  = -1;
                m_parent = null;
#endif
            }
            return(m_ptr);
        }
示例#5
0
        internal override IntPtr _InternalGetConstPointer()
        {
#if RHINO_SDK
            if (m_doc != null)
            {
                IntPtr rc = UnsafeNativeMethods.CRhinoGroupTable_FindGroupPtr(m_doc.RuntimeSerialNumber, m_id);
                if (rc == IntPtr.Zero)
                {
                    throw new Runtime.DocumentCollectedException($"Could not find Group with ID {m_id}");
                }
                return(rc);
            }
#endif

            FileIO.File3dm file_parent = m__parent as FileIO.File3dm;
            if (file_parent != null)
            {
                IntPtr pConstParent = file_parent.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_GetModelComponentPointer(pConstParent, m_id));
            }
            return(IntPtr.Zero);
        }
        internal IntPtr ConstPointer()
        {
            if (m_ptr != IntPtr.Zero)
            {
                return(m_ptr);
            }
            FileIO.File3dm parent_file = m_parent as FileIO.File3dm;
            if (parent_file != null)
            {
                IntPtr ptr_const_parent_file = parent_file.ConstPointer();
                return(UnsafeNativeMethods.ONX_Model_ViewPointer(ptr_const_parent_file, m_id, m_ptr, m_named_view_table));
            }
#if RHINO_SDK
            if (m_index >= 0)
            {
                RhinoDoc doc = m_parent as RhinoDoc;
                if (doc != null)
                {
                    return(UnsafeNativeMethods.CRhinoDocProperties_GetNamedView(doc.m_docId, m_index));
                }
            }
#endif
            throw new Runtime.DocumentCollectedException();
        }