Sub PrintVed()
' печать ведомости координат
Dim pMXD As IMxDocument
Dim i As Long, Angle As Double, Lz As Double
Dim pFeat As IFeature, pGeom As IGeometry, pp As IPoint
Dim pSelected As IEnumFeature
Set pMXD = ThisDocument
If pMXD.FocusMap.SelectionCount <> 1 Then Exit Sub
Set pSelected = pMXD.FocusMap.FeatureSelection
pSelected.Reset
Set pFeat = pSelected.Next
Dim Map As IMap, Line As ILine
Dim p1 As IPoint, p2 As IPoint, PC As IPointCollection
Set Map = pMXD.FocusMap
Map.DistanceUnits = esriMeters
Set PC = pFeat.ShapeCopy
For i = 0 To PC.PointCount - 1
Set pGeom = PC.Point(i)
Set pp = pGeom
Set p2 = pGeom
Set Line = New Line
If i > 0 Then
Lz = Map.ComputeDistance(p1, p2)
Line.PutCoords p1, p2
Angle = Line.Angle * 180 / (4 * Atn(1))
Angle = 90 - Angle
If Angle < 0 Then Angle = 270 - Angle
End If
Set p1 = pGeom
' номер точки, дирекционный угол, расстояние до предыдущ. точки, х,у
Debug.Print i, Angle, Lz, pp.X, pp.Y
Next
Exit Sub
SubErr:
MsgBox "Ошибка при экспорте данных" & vbCrLf & "Код ошибки:" & _
Err.Description, vbCritical + vbOKOnly, "Ошибка"
End Sub