@Jeff_M Couldn't you just compute the overall PI by intersecting the incoming and outgoing lines? In my tinkering I found that I shouldn't iterate through the AlignmentEntityCollection but rather use the GetEntityByOrder function.
Dim index As Integer = 0
For Each ent As AlignmentEntity In align.Entities
ed.WriteMessage(vbCrLf & "Index: " & index.ToString & " Entity Type: " + ent.EntityType.ToString)
If ent.SubEntityCount > 1 Then
For i As Integer = 1 To ent.SubEntityCount
Dim subEnt As AlignmentSubEntity = ent(i - 1)
ed.WriteMessage(vbCrLf & "Index: " & index.ToString & "." & i.ToString & " Sub Entity Type: " & subEnt.SubEntityType.ToString)
Next
End If
index += 1
Next
'Index: 0 Entity Type: Line
'Index: 1 Entity Type: Line
'Index: 2 Entity Type: SpiralCurveSpiral
'Index: 2.1 Sub Entity Type: Spiral
'Index: 2.2 Sub Entity Type: Arc
'Index: 2.3 Sub Entity Type: Spiral
The above entities are out of order.
For order As Integer = 0 To align.Entities.Count - 1
Dim ent As AlignmentEntity = align.Entities.GetEntityByOrder(order)
ed.WriteMessage(vbCrLf & "Index: " & order.ToString & " Entity Type: " + ent.EntityType.ToString)
If ent.SubEntityCount > 1 Then
For i As Integer = 1 To ent.SubEntityCount
Dim subEnt As AlignmentSubEntity = ent(i - 1)
ed.WriteMessage(vbCrLf & "Index: " & order.ToString & "." & i.ToString & " Sub Entity Type: " & subEnt.SubEntityType.ToString)
Next
End If
Next
These Entities are in order.
'Index: 0 Entity Type: Line
'Index: 1 Entity Type: SpiralCurveSpiral
'Index: 1.1 Sub Entity Type: Spiral
'Index: 1.2 Sub Entity Type: Arc
'Index: 1.3 Sub Entity Type: Spiral
'Index: 2 Entity Type: Line