Autodesk.Revit.DB.ReferencePointArrayIterator
是一个用于迭代Autodesk.Revit.DB.ReferencePointArray
中参照点的类。参照点是在Revit中定义的可移动点,通常用于约束和定位。
public ReferencePointArrayIterator(ReferencePointArray referencePointArray)
referencePointArray
: 要迭代的参照点数组public ReferencePoint Current { get; }
Current
: 获取ReferencePointArrayIterator
当前指向的Autodesk.Revit.DB.ReferencePoint
对象。public bool MoveNext()
MoveNext()
: 将ReferencePointArrayIterator
指针向下移动到参照点数组中的下一个元素。如果成功移动,则返回true
,否则返回false
。public void Reset()
Reset()
: 重置迭代器将指针移回参照点数组的第一个元素。以下示例演示如何使用ReferencePointArrayIterator
迭代ReferenceArray
中的参考点并将它们的坐标打印到控制台上:
using Autodesk.Revit.DB;
// ...
public void IterateReferenceArray(ReferenceArray referenceArray)
{
ReferencePointArray referencedPoints = new ReferencePointArray();
foreach (Reference reference in referenceArray)
{
Element elem = doc.GetElement(reference);
ReferencePoint rp = elem.Location as ReferencePoint;
if(rp != null)
referencedPoints.Append(rp);
}
ReferencePointArrayIterator it = referencedPoints.ForwardIterator();
while(it.MoveNext())
{
ReferencePoint rp = it.Current;
XYZ coordinate = rp.Position;
Console.WriteLine(coordinate.ToString());
}
}
ArgumentNullException
: 当传入的参考点数组为null时抛出的异常信息。