Revit API提供的阵列方法可以对一 个或者多个元素创建线型的或者是圆弧型的阵列。例如,可以选择墙上的一扇门或者一扇窗,阵列出多个门或窗的实体。
下面列出阵列方法及其描述。
方法 | 描述 |
static LinearArray Create(Document aDoc, View dBView, ElementId id, int count, XYZ translationToAnchorMember, ArrayAnchorMember anchorMember); | 从传入的元素中创边一个线型阵列 |
static LinearArray Create(Document aDoc, View dBView, ICollection<ElementId> ids, int count, XYZ translationToAnchorMember, ArrayAnchorMember anchorMember); | 从传入的元素集中创建一个线型阵列 |
static RadialArray Create(Document aDoc, View dBView, ElementId id, int count, Line axis, double angle, ArrayAnchorMember anchorMember); | 从传入的元素中创建一个基于旋转轴的圆弧型阵列 |
static RadialArray Create(Document aDoc, View dBView, ICollection<ElementId> ids, int count, Line axis, double angle, ArrayAnchorMember anchorMember); | 从传入的元素集中创建一个基于旋转轴的圆弧型阵列 |
阵列有两种类型:线型阵列和圆弧型阵列。
线型阵列是在Revit中呈线型状的阵列; 圆弧型阵列则呈圆弧型。
以下代码用线型阵列了一堵墙,阵列数为3,其阵列方向为Y向量,到第二个阵列元素的平移量为10英尺
public void ArraryElements(Document projectDoc)
{
//ElementId 313057 is a wall instance id
Wall wall = projectDoc.GetElement(new ElementId(313057)) as Wall;
using (Transaction tran = new Transaction(projectDoc, "LinearArray the wall."))
{
tran.Start();
XYZ translation = new XYZ(0, 10, 0);
LinearArray.Create(projectDoc, projectDoc.ActiveView, wall.Id, 3, translation,
ArrayAnchorMember.Second);
tran.Commit();
}
}
结果视图:
阵列里面每一个实体都是阵列组合的一个成员。
如上图所示,阵列组的成员为原来的墙以及阵列创建的另外2堵墙。如果需要创建几个相同组件的实体并同时操作它们,使用阵列方法是很方便的。
使用阵列方法需要注意以下几个方面:① 阵列数是有限定范围的, 线型阵列范围是2到200,圆弧型阵列是3到200。
② 当做线型和圆弧型阵列操作时,其他元素依赖于这个将被阵列的元素也会跟着一起阵列。
③ 有的元素不能被阵列:如section,因为它们不能被组合。
④ 大多数Annotation symbols是不支持阵列的。
LinearArray 和 RadialArray 也提供了 ArrayElementWithoutAssociate 和 ArrayElementsWithoutAssociate来阵列一个或者多个元素,这些元素是没有被组合和关联起来的,这些方法的使用类似于阵列的创建方法。
=========【更多高级应用请关注公众号】========
==================================