Hello Jack,
there are four new Create methods added in the R2016 API for Text notes. I believe all of them are rather simple and straightforward to use. I'll show two code snippets here, but I am positive you will have no problems to adjust it to your concrete needs:
This one snippet creates a text note which has an adjustable width (width that grows with the text contained withing). Typically, this creation method is used for creating one-line annotations. In this particular snippet I use the currently default TextNoteType, but you can use any other available text-note-type if you wish so.
using (Transaction tran = new Transaction(RevitDoc, "Creating a Text note"))
{
XYZ origin = new XYZ(10, 10, 0);
ElementId defaultTypeId = RevitDoc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType);
tran.Start();
TextNote note = TextNote.Create(RevitDoc, someView.Id, origin, "Text Note", defaultTypeId);
tran.Commit();
}
The next snippet shows creating a text box - that is a text note with a fixed width, as is normally created vi the UI when the end-user specifies the box of the new text note. Text content then wraps inside the box and extends the box' height if needed. The box' size can be controlled via the UI later after creation using the control points of the box. Also, in this example I show how to use the options to change some of the default properties of the new text object - the alignment in this particular case.
using (Transaction tran = new Transaction(RevitDoc, "Creating a Text note"))
{
XYZ origin = new XYZ(10, 10, 0);
double width = 3.0 / 12.0; // feet on paper
TextNoteOptions options = new TextNoteOptions();
options.HorizontalAlignment = HorizontalTextAlignment.Center;
options.TypeId = RevitDoc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType);
tran.Start();
TextNote note = TextNote.Create(RevitDoc, someView.Id, origin, width, "Text Box Content", options);
tran.Commit();
}
I hope this helps and you and others find it useful.
Arnošt Löbel