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.
- 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 Double
- count = 0
- tagstr = atr(1).TagString
- txtstr = atr(1).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
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement