记录一下TextNote的简单使用方法:
UIApplication uiApp = new UIApplication(commandData.Application.Application);
UIDocument uiDoc = commandData.Application.ActiveUIDocument;
Document doc = commandData.Application.ActiveUIDocument.Document;
using (Transaction trans = new Transaction(doc,"Text Node creation"))
{
trans.Start();
XYZ textLoc = uiDoc.Selection.PickPoint("Pick a point for sample text.");
ElementId defaultTextTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType);
TextNoteOptions opts = new TextNoteOptions(defaultTextTypeId);
opts.HorizontalAlignment = HorizontalTextAlignment.Left;//设置文字的位置
opts.Rotation = Math.PI / 4;//设置文字的倾斜角度
TextNote textNote = TextNote.Create(doc, doc.ActiveView.Id, textLoc,DateTime.Now.ToString(), opts);
trans.Commit();
}