Тема: Не знаю как тему обозначить!
Скажите пожалуйста почему код не работает:
Option Explicit
Const blkName As String = "П11"
Const attName2 As String = "П11(2х1х1)"
'~~~~~~~~~~~~~~~~~~~~~~~~~~~'
Sub CountBlocksByAttValue()
Dim oSset As AcadSelectionSet
Dim oEnt As AcadEntity
Dim oBlkRef As AcadBlockReference
Dim oAtt As AcadAttributeReference
Dim attArr() As AcadAttributeReference
Dim attVal1 As String
Dim attName2 As String
Dim i As Long
Dim counter As Integer
Dim ftype(1) As Integer
Dim fdata(1) As Variant
Dim dxfCode, dxfValue
On Error GoTo Err_Control
ftype(0) = 0: ftype(1) = 2
fdata(0) = "INSERT": fdata(1) = blkName
dxfCode = ftype: dxfValue = fdata
With ThisDrawing.SelectionSets
While .count > 0
.Item(0).Delete
Wend
Set oSset = .Add("$Blocks$")
End With
oSset.Select acSelectionSetAll, , , dxfCode, dxfValue
Dim NumStr As String
NumStr = ""
For Each oEnt In oSset
Set oBlkRef = oEnt
attArr = oBlkRef.GetAttributes
For i = 0 To UBound(attArr)
Set oAtt = attArr(i)
If StrComp(oAtt.TagString, attName2, vbTextCompare) = 0 Then
NumStr = NumStr & oAtt.TextString
Exit For
End If
Next i
Next oEnt
If Err Then
Err.Clear
End If
MsgBox NumStr
Err_Control:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
В переменную NumStr должны записываться все значения атрибута, а они не записываются.......