Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub sel()
- ' Create a new selection set
- Dim sset As AcadSelectionSet
- ' Set sset = ThisDrawing.SelectionSets.Add("SS1")
- Set sset = ThisDrawing.SelectionSets("SS1")
- ' Prompt the user to select objects
- ' and add them to the selection set.
- ' To finish selecting, press ENTER.
- Dim FilterType(0) As Integer
- Dim FilterData(0) As Variant
- sset.SelectOnScreen
- Dim obj As Variant
- Set obj = sset.Item(0)
- Dim thisdwg As AcadDocument
- Set thisdwg = ThisDrawing
- Dim atr As Variant
- atr = obj.GetAttributes
- 'Dim tagstr As String
- Dim txtstr As String
- Dim count As Integer
- count = 0
- 'tagstr = atr(1).TagString
- ' txtstr = atr(0).TextString
- 'Dim ModelSpace As AcadModelSpace
- 'Set ModelSpace = ThisDrawing.ModelSpace
- 'Dim obj2 As AcadEntity
- 'For Each obj2 In ModelSpace
- ' atr2 = obj2.GetAttributes
- ' If atr2(1).TextString = txtstr Then
- ' count = count + 1
- ' End If
- ' Next
- Dim Str As String
- Str = atr(0).TextString
- FilterType(0) = 2
- FilterData(0) = Str
- sset.Select acSelectionSetAll, , , FilterType, FilterData
- 'For Each entity In sset
- ' count = count + 1
- ' Next
- MsgBox sset.count
- sset.Highlight (True)
- Application.Update
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement