Спасибо за подсказки вымучил макрос как смог :)
Если кому интересно, полилиния сохраняется как теодолитный ход, в формате sdr измеренные углы, расстояния.c:\acad.sdr
Option Explicit
Sub acadsdr()
'макрос написан mvvgeo апрель 2007
'предназначен для написания полевых данных в условиях офиса, генерит
' sdr файл по нарисованной линии, в файле измеренные углы и длины линий.
Dim vertTextObj As AcadMText
Dim objEnt As AcadEntity
Dim spaceObj As AcadBlock
Dim TxtInsPoint(2) As Double
Dim dblWidth As Double
Dim strText As String
Dim n As Integer
Dim i As Integer
Dim id As Integer
Dim dzzzy As Integer
Dim z As Double, z1 As Double
Dim d1 As Double, d2 As Double
Dim l1 As Double, l2 As Double
ThisDrawing.StartUndoMark
MsgBox "Укажите полилинию хода (начало, как чертили)"
Close #1
Open "c:\acad.sdr" For Output As #1
Print #1, "00NMSDR33 V04-04.02 01-¬=T-02 00:00 111111"
Print #1, "10NMDOM18 121111"
Print #1, "06NM1.00000000"
Print #1, "01NM:SET610 V31-05 026662SET610 V31-05 02128431"
Print #1, "0.000"
'Print #1, "02TP"; Spc(14); "T11000.000 1000.000 150.000 1.36 MVV"
Print #1, "3 NM1 0.45"
If ThisDrawing.ActiveSpace = acModelSpace Then
Set spaceObj = ThisDrawing.ModelSpace
Else
Set spaceObj = ThisDrawing.PaperSpace
End If
Dim objSetPoly As AcadSelectionSet
Set objSetPoly = ThisDrawing.SelectionSets.Add("MyPoly")
objSetPoly.SelectOnScreen
For Each objEnt In objSetPoly
Dim vert As Variant
'Определяет проект 2д или 3д
If TypeOf objEnt Is AcadLWPolyline Then
n = 2
ElseIf TypeOf objEnt Is Acad3DPolyline Or TypeOf objEnt Is AcadPolyline Then
n = 3
Else
MsgBox "Неправильный объект"
End If
' берет координаты vert
vert = objEnt.Coordinates
For i = LBound(vert) To (UBound(vert) - 4) Step n
id = i * 0.5 + 1
Dim ax As Double, bx As Double, dx As Double
Dim ay As Double, by As Double, dy As Double
Dim A1x As Double, A2x As Double, line As Double
Dim A1y As Double, A2y As Double
Dim ugol As Double, get90angl As Double
If (i + 5) > UBound(vert) Then
Else
'If i = 0 Then
ax = vert(i)
ay = vert(i + 1)
bx = vert(i + 2)
by = vert(i + 3)
dx = vert(i + 4)
dy = vert(i + 5)
' Sub Example_Angle()
' угол и длинна линии по координатам
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double, endPoint(0 To 2) As Double
startPoint(0) = ax: startPoint(1) = ay: startPoint(2) = 0
endPoint(0) = bx: endPoint(1) = by: endPoint(2) = 0
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
'ThisDrawing.Application.ZoomAll
d1 = lineObj.Angle
l1 = lineObj.Length
startPoint(0) = bx: startPoint(1) = by: startPoint(2) = 0
endPoint(0) = dx: endPoint(1) = dy: endPoint(2) = 0
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
d2 = lineObj.Angle
l2 = lineObj.Length
d1 = Round(d1 * 180 / 3.141592654, 5)
d2 = Round(d2 * 180 / 3.141592654, 5)
l1 = Round(l1, 3)
l2 = Round(l2, 3)
z = d1
z1 = d2
d1 = 180 - d1 + d2
If d1 > 360 Then
d1 = d1 - 360
Else
End If
If d1 > 360 Then
d1 = d1 - 360
Else
End If
If d1 < 0 Then
d1 = d1 + 360
Else
End If
d1 = 360 - d1
'MsgBox "The angle of the new Line is: " & d1 & " " & l1
End If
dblWidth = 0#
'********************************************************************************
If id <= 9 Then
Print #1, "02TP"; Spc(14); "T" & id; "1000.000 1000.000 150.000 1.36 MVV"
Print #1, "09F1"; Spc(14); "T" & id; Spc(14); "T" & id - 1&; l1; Spc(8); "90.00000"; Spc(8); "0.00000"
Print #1, "09F1"; Spc(14); "T" & id; Spc(14); "T" & id + 1&; l2; Spc(8); "90.00000"; Spc(8); d1
Else
Print #1, "02TP"; Spc(13); "T" & id; "1000.000 1000.000 150.000 1.36 MVV"
Print #1, "09F1"; Spc(13); "T" & id; Spc(13); "T" & id - 1&; l1; Spc(8); "90.00000"; Spc(8); "0.00000"
Print #1, "09F1"; Spc(13); "T" & id; Spc(13); "T" & id + 1&; l2; Spc(8); "90.00000"; Spc(8); d1
End If
Next
Next
Close #1
objSetPoly.Delete
Set objSetPoly = Nothing
ThisDrawing.EndUndoMark
MsgBox "данные сохранены в файл c:\acad.sdr(для удаления построений нажмите ctrl+z)"
End Sub