0 Members and 1 Guest are viewing this topic.
Sub Fishies()Dim objGroup As AcadGroupDim objGroups As AcadGroupsDim intGroup As IntegerDim intTemp As IntegerDim objSelSet As AcadSelectionSetDim objSelSets As AcadSelectionSetsDim entGrouped() As AcadEntityOn Error GoTo ErrorControl Set objSelSets = ThisDrawing.SelectionSets Set objGroups = ThisDrawing.Groups KillSet "Grouper" Set objSelSet = objSelSets.Add("Grouper") objSelSet.SelectOnScreen For Each objGroup In objGroups intTemp = Right(objGroup.Name, 1) If intTemp > intGroup Then intGroup = intTemp End If Next objGroup ReDim entGrouped(0 To objSelSet.Count - 1) For intTemp = 0 To UBound(entGrouped) Set entGrouped(intTemp) = objSelSet.Item(intTemp) Next intTemp Set objGroup = objGroups.Add(intGroup + 1) objGroup.AppendItems entGroupedExitHere:Exit SubErrorControl: Select Case Err.Number Case Else MsgBox "''" & Err.Description & "'' error has occured in Fishies" & vbCrLf GoTo ExitHere End Select End SubFunction KillSet(strSet As String) Dim objSelSet As AcadSelectionSet Dim objSelSets As AcadSelectionSets Set objSelSets = ThisDrawing.SelectionSets For Each objSelSet In objSelSets If objSelSet.Name = strSet Then ThisDrawing.SelectionSets.Item(strSet).Delete Exit For End If NextEnd Function