Beispiel #1
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());
        }
 /// <summary>
 /// 获取字典的所有键名
 /// </summary>
 /// <param name="id">对象ID</param>
 /// <param name="dictionary">字典名</param>
 /// <returns>键名列表</returns>
 public static IEnumerable <string> GetEntryNames(ObjectId id, string dictionary)
 {
     return(CustomDictionary.GetEntryNames(getDictionaryId(id, dictionary)));
 }