Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.38 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.     Dim FilterType(0) As Integer
  11.     Dim FilterData(0) As Variant
  12.    
  13.     sset.SelectOnScreen
  14.    
  15.     Dim obj As Variant
  16.     Set obj = sset.Item(0)
  17.    
  18.     Dim thisdwg As AcadDocument
  19.     Set thisdwg = ThisDrawing
  20.      
  21.     Dim atr As Variant
  22.      
  23.     atr = obj.GetAttributes
  24.    
  25.     'Dim tagstr As String
  26.     Dim txtstr As String
  27.     Dim count As Integer
  28.     count = 0
  29.    
  30.     'tagstr = atr(1).TagString
  31.    ' txtstr = atr(0).TextString
  32.      
  33.    
  34.     'Dim ModelSpace As AcadModelSpace
  35.     'Set ModelSpace = ThisDrawing.ModelSpace
  36.     'Dim obj2 As AcadEntity
  37.    
  38.     'For Each obj2 In ModelSpace
  39.        ' atr2 = obj2.GetAttributes
  40.        ' If atr2(1).TextString = txtstr Then
  41.        '     count = count + 1
  42.        ' End If
  43.    
  44.    ' Next
  45.    Dim Str As String
  46.    Str = atr(0).TextString
  47.     FilterType(0) = 2
  48.     FilterData(0) = Str
  49.  
  50.  
  51.     sset.Select acSelectionSetAll, , , FilterType, FilterData
  52.     'For Each entity In sset
  53.        ' count = count + 1
  54.   '  Next
  55.   MsgBox sset.count
  56.  
  57.     sset.Highlight (True)
  58.     Application.Update
  59.    
  60. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement