Autodesk.Revit.DB.ReferencePointArray
是Revit API中的一个类,用于存储参考点的集合。
Autodesk.Revit.DB.ReferencePointArray
提供了以下构造函数:
ReferencePointArray()
:创建一个空的参考点集合。ReferencePointArray(IEnumerable<ReferencePoint>)
:创建一个包含指定参考点集合中所有参考点的新实例。Autodesk.Revit.DB.ReferencePointArray
提供了以下属性:
this[int index]
:获取或设置在给定索引处的参考点。IsFixedSize
:获取是否具有固定大小。IsReadOnly
:获取是否为只读。Autodesk.Revit.DB.ReferencePointArray
提供了以下方法:
Clear()
:从集合中移除所有参考点。Contains(ReferencePoint item)
:确定集合是否包含特定的参考点。CopyTo(ReferencePoint[] array, int arrayIndex)
:从特定的数组索引开始,将参考点集合的元素复制到一个数组中。GetEnumerator()
:返回循环访问参考点集合的枚举器。IndexOf(ReferencePoint item)
:搜索指定的参考点,并返回在整个集合中找到的第一个匹配项的索引。Insert(int index, ReferencePoint item)
:将参考点插入到集合中的指定索引处。Remove(ReferencePoint item)
:从集合中移除特定的参考点。RemoveAt(int index)
:移除集合中指定索引处的参考点。以下示例展示了如何使用Autodesk.Revit.DB.ReferencePointArray
。
// 创建一个参考点集合
ReferencePointArray referencePointArray = new ReferencePointArray();
// 添加参考点到集合中
XYZ point1 = new XYZ(0, 0, 0);
ReferencePoint referencePoint1 = doc.FamilyCreate.NewReferencePoint(point1);
referencePointArray.Append(referencePoint1);
XYZ point2 = new XYZ(10, 0, 0);
ReferencePoint referencePoint2 = doc.FamilyCreate.NewReferencePoint(point2);
referencePointArray.Append(referencePoint2);
// 遍历参考点集合
foreach (ReferencePoint referencePoint in referencePointArray)
{
// Do something with referencePoint
}
// 获取特定参考点
ReferencePoint myReferencePoint = referencePointArray[0];
// 更新参考点
XYZ newPoint = new XYZ(5, 5, 0);
myReferencePoint.Position = newPoint;