Message 1 of 3

Not applicable
08-15-2017
02:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm having an issue, where I select an element, retrieve its ID, however when I try doc.GetElement() it returns null. I'm wondering if it is because I am running this in a family document (something I am not used to)
Document doc = this.Document; if( !doc.IsFamilyDocument ) { TaskDialog.Show("Fam Doc", "Must be run in a family document"); } FamilyManager mgr = doc.FamilyManager; Selection selection = this.Application.ActiveUIDocument.Selection; ICollection<ElementId> selectedIds = selection.GetElementIds(); ElementId id = selectedIds.First(); // is null Element test = doc.GetElement(id); // fails because test is null ParameterSet pSet = test.Parameters;
Attached is the family file I am using, I selected element 3008 (the upper middle extrusion on the Ref. Level floor plan), however any element selection should yield the same failure.
Thanks!
Solved! Go to Solution.