public void BackOpeningGeometry( Element elem,Document doc)
{
ReferenceArray array = new ReferenceArray();
Options option =new Options();
option.ComputeReferences = true;//允许 面 边 点 有效引用
option.DetailLevel = ViewDetailLevel.Medium;//构件的详细程度
option.IncludeNonVisibleObjects = true;//不可见的几何
GeometryElement groElement = elem.get_Geometry(option);
List(Line) list = new List(Line)();
foreach (GeometryObject groObj in groElement)
{
if (groObj is Line)//非标准族实例
{
Line line = groObj as Line;
list.Add(line);
}
}
list = list.Where(o => Math.Abs((o.GetEndPoint(0) - o.GetEndPoint(1)).Normalize().Z) != 1).OrderBy(o => o.GetEndPoint(0).Z).ToList();
array.Append(list[4].GetEndPointReference(0));
array.Append(list[6].GetEndPointReference(1));
Line lines = Line.CreateBound(list[4].GetEndPoint(0),list[6].GetEndPoint(1));
using (Transaction ts = new Transaction(doc, "del"))
{
ts.Start();
doc.Create.NewDimension(doc.ActiveView, lines, array);
ts.Commit();
}
}