internal override IntPtr _InternalGetConstPointer()
        {
#if RHINO_SDK
            Rhino.DocObjects.RhinoObject parent_object = m__parent as Rhino.DocObjects.RhinoObject;
            if (null == parent_object)
            {
                Rhino.FileIO.File3dmObject parent_model_object = m__parent as Rhino.FileIO.File3dmObject;
                if (parent_model_object != null)
                {
                    return(parent_model_object.GetAttributesConstPointer());
                }
            }
            IntPtr pConstParent = IntPtr.Zero;
            if (null != parent_object)
            {
                pConstParent = parent_object.ConstPointer();
            }
            return(UnsafeNativeMethods.CRhinoObject_Attributes(pConstParent));
#else
            Rhino.FileIO.File3dmObject parent_model_object = m__parent as Rhino.FileIO.File3dmObject;
            if (parent_model_object != null)
            {
                return(parent_model_object.GetAttributesConstPointer());
            }
            return(IntPtr.Zero);
#endif
        }
Пример #2
0
        /// <summary>
        /// Gets a value indicating if this visual analysis mode can be used on a given Rhino object.
        /// </summary>
        /// <param name="obj">The object to be tested.</param>
        /// <returns>true if this mode can indeed be used on the object; otherwise false.</returns>
        public virtual bool ObjectSupportsAnalysisMode(Rhino.DocObjects.RhinoObject obj)
        {
            IntPtr pConstPointer     = ConstPointer();
            IntPtr pConstRhinoObject = obj.ConstPointer();

            return(UnsafeNativeMethods.CRhinoVisualAnalysisMode_ObjectSupportsAnalysisMode(pConstPointer, pConstRhinoObject));
        }
Пример #3
0
        /// <summary>
        /// Returns the underlying const CRhinoObject* for a RhinoCommon class. You should only
        /// be interested in using this function if you are writing C++ code.
        /// </summary>
        /// <param name="rhinoObject">A Rhino object.</param>
        /// <returns>A pointer to the Rhino const object.</returns>
        public static IntPtr RhinoObjectConstPointer(Rhino.DocObjects.RhinoObject rhinoObject)
        {
            IntPtr rc = IntPtr.Zero;

            if (rhinoObject != null)
            {
                rc = rhinoObject.ConstPointer();
            }
            return(rc);
        }
        /// <summary>
        /// Returns a bounding box for the custom render meshes for the given object.
        /// </summary>
        /// <param name="vp"> the viewport being rendered.</param>
        /// <param name="obj">Rhino object of interest.</param>
        /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param>
        /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param>
        /// <returns>ON_BoundingBox for the meshes.</returns>
        public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType)
        {
            Rhino.Geometry.Point3d min = new Geometry.Point3d();
            Rhino.Geometry.Point3d max = new Geometry.Point3d();

            Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox();

            if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBox(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max))
            {
                bb.Min = min;
                bb.Max = max;
            }

            return(bb);
        }
Пример #5
0
        /// <summary>
        /// Decomposes the hatch pattern into an array of geometry.
        /// </summary>
        /// <returns>An array of geometry that formed the appearance of the original elements.</returns>
        /// <example>
        /// <code source='examples\vbnet\ex_explodehatch.vb' lang='vbnet'/>
        /// <code source='examples\cs\ex_explodehatch.cs' lang='cs'/>
        /// <code source='examples\py\ex_explodehatch.py' lang='py'/>
        /// </example>
        public GeometryBase[] Explode()
        {
            using (Rhino.Runtime.InteropWrappers.SimpleArrayGeometryPointer geometry = new Rhino.Runtime.InteropWrappers.SimpleArrayGeometryPointer())
            {
                IntPtr pParentRhinoObject = IntPtr.Zero;

                if (IsDocumentControlled)
                {
                    Rhino.DocObjects.RhinoObject rhobj = ParentRhinoObject();
                    if (rhobj != null)
                    {
                        pParentRhinoObject = rhobj.ConstPointer();
                    }
                }
                IntPtr pGeometryArray = geometry.NonConstPointer();
                IntPtr pConstThis     = ConstPointer();

                UnsafeNativeMethods.ON_Hatch_Explode(pConstThis, pParentRhinoObject, pGeometryArray);
                GeometryBase[] rc = geometry.ToNonConstArray();
                return(rc);
            }
        }
        /// <summary>
        /// Returns a bounding box for the custom render meshes for the given object.
        /// </summary>
        /// <param name="vp">The viewport being rendered.</param>
        /// <param name="obj">The Rhino object of interest.</param>
        /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param>
        /// <param name="meshType">Type of mesh to build.</param>
        /// <returns>A bounding box value.</returns>
        public virtual Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType)
        {
            Geometry.Point3d min = new Geometry.Point3d();
            Geometry.Point3d max = new Geometry.Point3d();

            if (UnsafeNativeMethods.Rdk_RMPBoundingBoxImpl(m_runtime_serial_number, vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, ref min, ref max))
            {
                return(new Rhino.Geometry.BoundingBox(min, max));
            }

            return(new Rhino.Geometry.BoundingBox());
        }
        /// <summary>
        /// Returns a bounding box for the custom render meshes for the given object.
        /// </summary>
        /// <param name="vp"> the viewport being rendered.</param>
        /// <param name="obj">Rhino object of interest.</param>
        /// <param name="requestingPlugIn">UUID of the RDK plug-in requesting the meshes.</param>
        /// <param name="meshType"> type of mesh(es) to build the bounding box for.</param>
        /// <param name="soleProviderId">the sole provider to call.</param>
        /// <returns>ON_BoundingBox for the meshes.</returns>
        public static Rhino.Geometry.BoundingBox BoundingBox(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType, Guid soleProviderId)
        {
            Geometry.Point3d min = new Geometry.Point3d();
            Geometry.Point3d max = new Geometry.Point3d();

            if (UnsafeNativeMethods.Rdk_CRMManager_BoundingBoxSole(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType, soleProviderId, ref min, ref max))
            {
                Rhino.Geometry.BoundingBox bb = new Geometry.BoundingBox();
                return(bb);
            }

            return(new Geometry.BoundingBox());
        }
 /// <summary>
 /// Determines if custom render meshes will be built for a particular object.
 /// </summary>
 /// <param name="vp">the viewport being rendered.</param>
 /// <param name="obj">the Rhino object of interest.</param>
 /// <param name="requestingPlugIn">type of mesh to build.</param>
 /// <param name="meshType">UUID of the plug-in requesting the meshes.</param>
 /// <returns>true if BuildCustomMeshes() will build custom render mesh(es) for the given object.</returns>
 public static bool WillBuildCustomMeshes(Rhino.DocObjects.ViewportInfo vp, Rhino.DocObjects.RhinoObject obj, Guid requestingPlugIn, MeshTypes meshType)
 {
     return(UnsafeNativeMethods.Rdk_CRMManager_WillBuildCustomMesh(vp.ConstPointer(), obj.ConstPointer(), requestingPlugIn, (int)meshType));
 }
 public static void ForceObjectIntoPreviewCache(Rhino.DocObjects.RhinoObject obj)
 {
     UnsafeNativeMethods.Rdk_CRMManager_EVF("ForceObjectIntoPreviewCache", obj.ConstPointer());
 }
 public static void ObjectChanged(Rhino.DocObjects.RhinoObject obj)
 {
     UnsafeNativeMethods.Rdk_CRMManager_EVF("ObjectChanged", obj.ConstPointer());
 }
 public ObjectMeshes(Rhino.DocObjects.RhinoObject obj)
 {
     m_pRenderMeshes = UnsafeNativeMethods.Rdk_CustomMeshes_New(obj.ConstPointer());
     m_bAutoDelete   = true;
 }
Пример #12
0
        /// <summary>
        /// Returns the effective linetype index to be used to find the
        /// linetype definition to draw an object. If an object's linetype
        /// source is LinetypeFromObject, the linetype index in the object's
        /// attributes is used. If an object's linetype source is LinetypeFromLayer
        /// the linetype index from the object's layer is used.
        /// </summary>
        /// <param name="rhinoObject">The Rhino object to use in the query.</param>
        /// <returns>The effective linetype index.</returns>
        public int LinetypeIndexForObject(Rhino.DocObjects.RhinoObject rhinoObject)
        {
            IntPtr pConstRhinoObject = rhinoObject.ConstPointer();

            return(UnsafeNativeMethods.CRhinoLinetypeTable_EffectiveLinetypeIndex(m_doc.RuntimeSerialNumber, pConstRhinoObject));
        }