ポイント コレクションを使用する

ドキュメント内のすべてのポイントは、AeccPoints 型のオブジェクトである AeccDocument.Points プロパティに保持されます。通常のコレクション プロパティとコレクション メソッドに加え、ポイント オブジェクトは大量のポイントを一度に処理するためのメソッドも備えています。AeccPoints.AddMultiple メソッドを使用すると、ポイントの配列を追加できます。

次の例では、一連のポイントを AddMultiple を使用して AeccDocument.Points コレクションに追加し、コレクション内のポイントに直接アクセスします。

' This adds an array of point locations to the document's
' points collection.
Dim lNumAdded As Long
Const NUM_LOCATIONS As Long = 3
' One dimensional array, 3 for each point location.
Dim dLocations(0 To (3 * NUM_LOCATIONS) - 1) As Double
' One point per line
dLocations(0) = 4927: dLocations(1) = 3887: dLocations(2) = 150
dLocations(3) = 5101: dLocations(4) = 3660: dLocations(5) = 250
dLocations(6) = 5144: dLocations(7) = 3743: dLocations(8) = 350
lNumAdded = oPoints.AddMultiple(NUM_LOCATIONS, dLocations, 0)
 
' This computes the average elevation of all points in a document.
Dim oPoints As AeccPoints
Dim i As Long
Dim avgElevation As Double
Set oPoints = g_oAeccDocument.Points
For i = 0 To oPoints.Count - 1
    avgElevation = avgElevation + oPoints.Item(i).Elevation
Next i
avgElevation = avgElevation / oPoints.Count
MsgBox "Average elevation: "& avgElevation & _
  vbNewLine & "Number of points: " & oPoints.Count