Exemplo n.º 1
0
        /// <summary>
        /// View entities interactively.
        /// </summary>
        /// <param name="entityIds">The entity IDs.</param>
        /// <param name="action">The action.</param>
        public static void ZoomHighlightView(List <ObjectId> entityIds, Action <int> action = null) // newly 20130815
        {
            if (entityIds.Count > 0)
            {
                var highlightIds = new List <ObjectId>();
                while (true)
                {
                    string input = Interaction.GetString("\nType in a number to view, press ENTER to exit: ");
                    if (input == null)
                    {
                        break;
                    }
                    var index = Convert.ToInt32(input);
                    if (index <= 0 || index > entityIds.Count)
                    {
                        Interaction.WriteLine("Invalid entity number.");
                        continue;
                    }

                    action?.Invoke(index);
                    highlightIds.Clear();
                    highlightIds.Add(entityIds[index - 1]);
                    Interaction.ZoomObjects(highlightIds);
                    Interaction.HighlightObjects(highlightIds);
                }
            }
        }
Exemplo n.º 2
0
        public static void ShowObject()
        {
            var    ids     = QuickSelection.SelectAll().ToArray();
            double handle1 = Interaction.GetValue("Handle of entity");

            if (double.IsNaN(handle1))
            {
                return;
            }
            long handle2 = Convert.ToInt64(handle1);
            var  id      = HostApplicationServices.WorkingDatabase.GetObjectId(false, new Handle(handle2), 0);
            var  col     = new ObjectId[] { id };

            Interaction.HighlightObjects(col);
            Interaction.ZoomObjects(col);
        }