下載app免費領取會員
在Revit項目文件里創(chuàng)建標注可以用
NewDimension
這個方法有兩個重載,一個使用默認的標注類型,一個可以指定標注類型
在項目文件和在族文件能創(chuàng)建的標注種類是不一樣的,讀者可以自己研究研究
下面是一個標注墻的小例子:
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
Wall wall = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element)) as Wall;
if (wall != null)
{
ReferenceArray refArry = new ReferenceArray();
Line wallLine =(wall.Location as LocationCurve).Curve as Line;
XYZ wallDir = ((wall.Location as LocationCurve).Curve as Line).Direction;
Options opt = new Options();
opt.ComputeReferences = true;
opt.DetailLevel = ViewDetailLevel.Fine;
GeometryElement gelem = wall.get_Geometry(opt);
foreach (GeometryObject gobj in gelem)
{
if (gobj is Solid)
{
Solid solid = gobj as Solid;
foreach (Face face in solid.Faces)
{
if (face is PlanarFace)
{
XYZ faceDir =face.ComputeNormal(new UV());
if (faceDir.IsAlmostEqualTo(wallDir)||faceDir.IsAlmostEqualTo(-wallDir))
{
refArry.Append(face.Reference);
}
}
}
}
}
Transaction trans = new Transaction(doc, "trans");
trans.Start();
doc.Create.NewDimension(doc.ActiveView, wallLine, refArry);
trans.Commit();
}
return Result.Succeeded;
本文版權歸腿腿教學網(wǎng)及原創(chuàng)作者所有,未經(jīng)授權,謝絕轉載。
上一篇:二次開發(fā)教程:Revit開發(fā)通過API 創(chuàng)建族