public IList <TextNote> SelectText(UIDocument UIdoc) { IList <Reference> selectedElements = new List <Reference>(); IList <TextNote> selectedTextNotes = new List <TextNote>(); ISelectionFilter selecFilter = new TextNoteSelectionFilter(); selectedElements = UIdoc.Selection.PickObjects(ObjectType.Element, selecFilter); Debug("selected elements" + selectedElements.Count); foreach (Reference r in selectedElements) { Element e = UIdoc.Document.GetElement(r.ElementId); TextNote t = e as TextNote; if (t != null) { selectedTextNotes.Add(t); Debug("selected elements" + selectedTextNotes.Count); } } return(selectedTextNotes); }
public TextNote SelectText(UIDocument UIdoc) { ISelectionFilter selecFilter = new TextNoteSelectionFilter(); Reference selectedElement = UIdoc.Selection.PickObject(ObjectType.Element, selecFilter); Element e = UIdoc.Document.GetElement(selectedElement.ElementId); TextNote t = e as TextNote; if (t != null) { TextNote selectedTextNote = t; Debug("selected elements" + selectedTextNote.ToString()); return(selectedTextNote); } return(null); }