Revit API 创建带箭头的标注
![](https://images.cnblogs.com/cnblogs_com/greatverve/QQ%E6%88%AA%E5%9B%BE20120704164017.png)
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmd : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(doc, "http://revit.5d6d.com");
ts.Start();
XYZ xyzOrigin = sel.PickPoint();
XYZ pt1 = sel.PickPoint();
XYZ pt2 = sel.PickPoint();
//
XYZ baseVec = new XYZ(0, 0, 0);
XYZ upVec = new XYZ(0, 0, 0);
double dWidth = 0.16;
TextAlignFlags textAlign = TextAlignFlags.TEF_ALIGN_LEFT | TextAlignFlags.TEF_ALIGN_TOP;
TextNote textNote = doc.Create.NewTextNote(
doc.ActiveView, xyzOrigin, baseVec, upVec, dWidth, textAlign
, TextNoteLeaderTypes.TNLT_STRAIGHT_L, TextNoteLeaderStyles.LCS_ONE_SEG_LINE, pt1, pt2, "标注");
ts.Commit();
return Result.Succeeded;
}
}
[Regeneration(RegenerationOption.Manual)]
public class cmd : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(doc, "http://revit.5d6d.com");
ts.Start();
XYZ xyzOrigin = sel.PickPoint();
XYZ pt1 = sel.PickPoint();
XYZ pt2 = sel.PickPoint();
//
XYZ baseVec = new XYZ(0, 0, 0);
XYZ upVec = new XYZ(0, 0, 0);
double dWidth = 0.16;
TextAlignFlags textAlign = TextAlignFlags.TEF_ALIGN_LEFT | TextAlignFlags.TEF_ALIGN_TOP;
TextNote textNote = doc.Create.NewTextNote(
doc.ActiveView, xyzOrigin, baseVec, upVec, dWidth, textAlign
, TextNoteLeaderTypes.TNLT_STRAIGHT_L, TextNoteLeaderStyles.LCS_ONE_SEG_LINE, pt1, pt2, "标注");
ts.Commit();
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。