示例#1
0
        public static void SelectByLayer()
        {
            string[] options = DbHelper.GetAllLayerNames();
            string[] opt     = Gui.GetChoices("Specify layers", options);
            if (opt.Length < 1)
            {
                return;
            }
            var ids = QuickSelection.SelectAll().QWhere(x => opt.Contains(x.Layer)).ToArray();

            Interaction.SetPickSet(ids);
        }
示例#2
0
        public static void LoadSelection()
        {
            string name = Gui.GetChoice("Which selection to load?", CustomDictionary.GetEntryNames("Selections").ToArray());

            if (name == string.Empty)
            {
                return;
            }
            string          dictValue = CustomDictionary.GetValue("Selections", name);
            var             handles   = dictValue.Split('|').Select(x => new Handle(Convert.ToInt64(x))).ToList();
            List <ObjectId> ids       = new List <ObjectId>();

            handles.ForEach(x =>
            {
                ObjectId id = ObjectId.Null;
                if (HostApplicationServices.WorkingDatabase.TryGetObjectId(x, out id))
                {
                    ids.Add(id);
                }
            });
            Interaction.SetPickSet(ids.ToArray());
        }