public static void SaveSelection() { var ids = Interaction.GetPickSet(); if (ids.Length == 0) { Interaction.WriteLine("No entity selected."); return; } string name = Interaction.GetString("\nSelection name"); if (name == null) { return; } if (CustomDictionary.GetValue("Selections", name) != string.Empty) { Interaction.WriteLine("Selection with the same name already exists."); return; } var handles = ids.QSelect(x => x.Handle.Value.ToString()).ToArray(); string dictValue = string.Join("|", handles); CustomDictionary.SetValue("Selections", name, dictValue); }
public void TestCustomDictionary() { CustomDictionary.SetValue("dict1", "A", "apple"); CustomDictionary.SetValue("dict1", "B", "orange"); CustomDictionary.SetValue("dict1", "A", "banana"); CustomDictionary.SetValue("dict2", "A", "peach"); foreach (var dict in CustomDictionary.GetDictionaryNames()) { Interaction.WriteLine(dict); } Interaction.WriteLine(CustomDictionary.GetValue("dict1", "A")); }