Heres my example-attempt:
- Sub test() 'define a named function 'Filter for circles - I don't know how to implement this type of filtering: 'Dim gpCode(0) As Integer 'Dim dataValue(0) As Variant 'gpCode(0) = 0 'dataValue(0) = "Circle" Dim SS As AcadSelectionSet 'Declare "SS" variable as local Set SS = ThisDrawing.SelectionSets.Add("NewSS") 'create a new selection set object [include it in the "SelectionSets" collection] SS.SelectOnScreen 'select the objects to change (invoke the "SelectOnScreen" method) For Each Entity In SS 'iterate over the selection set If Entity.ObjectName = "AcDbCircle" Then 'Filter for circles by objectname Entity.color = 1 'change entity's colour End If Next 'process the next entity MsgBox SS.Count 'alert the total selected amount of objects SS.Delete 'delete the selection set object [exclude it from the "SelectionSets" collection]End Sub
I'm just starting to learn about VBA, so any inputs are appreciated. |