Message 1 of 3

Not applicable
09-25-2017
06:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a collection of areas, and want to prompt the user to select additional areas by using PickObjects method. Unfortunately, PickObjects only accepts a list of references, and I cannot find a way to get references to my areas. Thought this might work, but it throws an "object reference not set to an instance of an object" error:
internal IList<Reference> getRefs(List<Area> areas) { IList<Reference> selected = new List<Reference>(); try { foreach (Area area in areas) { selected.Add((area as Object)as Reference); } return selected; } catch(Exception e) { MessageBox.Show(e.ToString()); } return null; }
This thread seemed like it might contain helpful info on a similar problem, but the answer in there did not work for me: https://forums.autodesk.com/t5/revit-api-forum/using-elements-selected-before-a-command-is-started/t...
Help would be greatly appreciated!
Solved! Go to Solution.