Ejemplo n.º 1
0
        /// <summary>
        /// Is the specified object currently selected?
        /// </summary>
        /// <param name="objID"></param>
        /// <returns></returns>
        public static bool ObjectSelected(Guid objID)
        {
            RhinoObject obj = GetObject(objID);

            if (obj != null && obj.IsSelected(false) > 0)
            {
                return(true);                                          //TODO: Check docs
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 private bool IsObjectIgnoredBySelection(RhinoObject InObject, RhinoSceneHierarchyNode ParentNode)
 {
     return(!ParentNode.bIsInstanceDefinition &&
            ExportOptions.WriteSelectedObjectsOnly &&
            InObject.IsSelected(/*checkSubObjects=*/ true) == 0);
 }
Ejemplo n.º 3
0
        protected override void DrawOverlay(Rhino.Display.DrawEventArgs e)
        {
            base.DrawOverlay(e);

            List <Guid> noDupGUIDs = new List <Guid>();


            for (int i = 0; i < Ids.Count; i++)
            {
                if (noDupGUIDs.Contains(Ids[i]))
                {
                }
                else
                {
                    noDupGUIDs.Add(Ids[i]);
                    RhinoObject foundObject = Rhino.RhinoDoc.ActiveDoc.Objects.Find(Ids[i]);
                    int         isSelected  = foundObject.IsSelected(false);

                    switch (foundObject.ObjectType)
                    {
                    case Rhino.DocObjects.ObjectType.Point:
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(((Rhino.Geometry.Point)foundObject.Geometry).Location, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(((Rhino.Geometry.Point)foundObject.Geometry).Location, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Curve:
                        Rhino.Geometry.Curve myCurve = (Rhino.Geometry.Curve)foundObject.Geometry;
                        myCurve.Domain = new Rhino.Geometry.Interval(0, 1);
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myCurve.PointAtNormalizedLength(0.5), i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myCurve.PointAtNormalizedLength(0.5), i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Extrusion:
                        Rhino.Geometry.Extrusion myExtru         = (Rhino.Geometry.Extrusion)foundObject.Geometry;
                        Rhino.Geometry.Point3d   myExtruLocation = myExtru.GetBoundingBox(true).Center;
                        //Rhino.Geometry.Point3d myExtruCentroid = Rhino.Geometry.AreaMassProperties.Compute(myExtru.ToBrep()).Centroid;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myExtruLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myExtruLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Brep:
                        Rhino.Geometry.Brep    myBrep         = (Rhino.Geometry.Brep)foundObject.Geometry;
                        Rhino.Geometry.Point3d myBrepLocation = myBrep.GetBoundingBox(true).Center;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myBrepLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myBrepLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Mesh:
                        var mesh = foundObject.Geometry as Rhino.Geometry.Mesh;
                        Rhino.Geometry.Point3d myMeshLocation = mesh.GetBoundingBox(true).Center;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myMeshLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myMeshLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.TextDot:
                        var textDot = (TextDot)foundObject.Geometry;
                        break;

                    case Rhino.DocObjects.ObjectType.Annotation:
                        var textObj = (Rhino.Geometry.TextEntity)foundObject.Geometry;
                        break;
                    }
                }
            }

            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }