Exemple #1
0
        /// <summary>
        /// 多个实体,输入编号逐个查看
        /// </summary>
        /// <param name="ids">实体ID数组</param>
        /// <param name="action">动作</param>
        public static void ZoomHighlightView(List <ObjectId> ids, Action <int> action = null) // newly 20130815
        {
            if (ids.Count > 0)
            {
                List <ObjectId> highlightIds = new List <ObjectId>();
                while (true)
                {
                    string input = Interaction.GetString("\n输入编号查看,按回车退出");
                    if (input == null)
                    {
                        break;
                    }
                    var index = Convert.ToInt32(input);
                    if (index <= 0 || index > ids.Count)
                    {
                        Interaction.WriteLine("编号不在范围内。");
                        continue;
                    }

                    if (action != null)
                    {
                        action(index);
                    }
                    highlightIds.Clear();
                    highlightIds.Add(ids[index - 1]);
                    Interaction.ZoomObjects(highlightIds);
                    Interaction.HighlightObjects(highlightIds);
                }
            }
        }
Exemple #2
0
        public static void ShowObject()
        {
            ObjectId[] 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);
        }