Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Sub sel()
  2. ' Create a new selection set
  3. Dim sset As AcadSelectionSet
  4. 'Set sset = ThisDrawing.SelectionSets.Add("SS1")
  5. Set sset = ThisDrawing.SelectionSets("SS1")
  6.  
  7. ' Prompt the user to select objects
  8. ' and add them to the selection set.
  9. ' To finish selecting, press ENTER.
  10. sset.SelectOnScreen
  11.  
  12. Dim obj As Variant
  13. Set obj = sset.Item(0)
  14.  
  15. Dim thisdwg As AcadDocument
  16. Set thisdwg = ThisDrawing
  17.  
  18. Dim atr As Variant
  19.  
  20. atr = obj.GetAttributes
  21.  
  22. Dim tagstr As String
  23. Dim txtstr As String
  24. Dim count As Double
  25. count = 0
  26.  
  27. tagstr = atr(1).TagString
  28. txtstr = atr(1).TextString
  29.  
  30.  
  31. Dim ModelSpace As AcadModelSpace
  32. Set ModelSpace = ThisDrawing.ModelSpace
  33. Dim obj2 As AcadEntity
  34.  
  35. For Each obj2 In ModelSpace
  36. atr2 = obj2.GetAttributes
  37. If atr2(1).TextString = txtstr Then
  38. count = count + 1
  39. End If
  40.  
  41. Next
  42.  
  43. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement