> Marat
Так можно получить данные и записать в таблицу:
Sub ArmXDataGet()
Dim oSset As AcadSelectionSet
Dim oEnt
Dim objLine As AcadLine
Dim fcode(0) As Integer
Dim fdata(0) As Variant
Dim dxfcode, dxfdata
Dim i As Integer
Dim setName As String
Dim xdataOut As Variant
Dim xtypeOut As Variant
fcode(0) = 0
fdata(0) = "LINE"
dxfcode = fcode
dxfdata = fdata
setName = "$LineSet$"
On Error GoTo Err_Msg
For i = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(i).Name = setName Then
ThisDrawing.SelectionSets.Item(i).Delete
Exit For
End If
Next i
Set oSset = ThisDrawing.SelectionSets.Add(setName)
oSset.SelectOnScreen dxfcode, dxfdata
Dim DataType(0 To 5) As Integer
Dim Data(0 To 5) As Variant
Dim appName As String
MsgBox "Выбрано: " & CStr(oSset.Count) & " линий"
Dim oTable As AcadTable
Dim insPt
Dim iRows As Long, iCols As Long
Dim rowHgt As Double, colWid As Double
Dim m As Long, n As Long
Dim tmpStr As String
Dim sumWeight As Double
insPt = ThisDrawing.Utility.GetPoint(, "Pick table insertion point:")
iRows = oSset.Count + 3
iCols = 4
rowHgt = 1.5
colWid = 21.5
Set oTable = ThisDrawing.ModelSpace.AddTable(insPt, iRows, iCols, rowHgt, colWid)
m = 0
n = 0
tmpStr = "Спецификация"
oTable.SetText m, n, tmpStr
m = 1
Dim headArr
headArr = Array("Позиция", "Длина", "Диаметр", "Вес")
For n = 0 To UBound(headArr)
tmpStr = headArr(n)
oTable.SetText m, n, tmpStr
Next n
m = 2
n = 0
sumWeight = 0#
For Each oEnt In oSset
Set objLine = oEnt
objLine.GetXData "", xtypeOut, xdataOut
With oTable
tmpStr = xdataOut(1)
.SetText m, n, tmpStr
n = n + 1
tmpStr = ThisDrawing.Utility.RealToString(xdataOut(3), acDecimal, 2)
.SetText m, n, tmpStr
n = n + 1
tmpStr = xdataOut(4)
.SetText m, n, tmpStr
n = n + 1
sumWeight = sumWeight + xdataOut(5)
tmpStr = ThisDrawing.Utility.RealToString(xdataOut(5), acDecimal, 2)
.SetText m, n, tmpStr
n = n + 1
End With
m = m + 1
n = 0
Next
n = 2
tmpStr = "Общий вес:"
oTable.SetText m, n, tmpStr
n = n + 1
tmpStr = ThisDrawing.Utility.RealToString(sumWeight, acDecimal, 2)
oTable.SetText m, n, tmpStr
oTable.RecomputeTableBlock True
ThisDrawing.Regen acActiveViewport
Err_Msg:
End Sub
~'J'~