View Full Version : Get rid of those Groups
TobyKanoby
2006-11-18, 07:14 PM
We have some drawings from customers that have many groups that show up in the Object Grouping dialogue that aren’t anywhere in the drawings. How do I get rid of them to make the drawing size smaller! Would wblock command work or is there a way using VBA or Autolisp?
rkmcswain
2006-11-18, 07:55 PM
...many groups... How do I get rid of them...?
You might take a look at:
http://groups.google.com/group/autodesk.autocad.customization/msg/fb211d30747febec?hl=en&fwc=1
Here is an example on VBA :
Sub ch_delgroup()
Dim oGroup As AcadGroup
On Error GoTo err_control
For Each oGroup In ThisDrawing.Groups
If oGroup.Count > 0 Then
oGroup.Delete
End If
Next
Exit Sub
err_control:
MsgBox Err.Description
End Sub
and here is on lisp:
(defun C:GDR (/ a acapp adoc agrps i)
(vl-load-com)
(setq acapp (vlax-get-acad-object)
adoc (vla-get-activedocument acapp)
agrps (vla-get-groups adoc)
)
(if (zerop (vla-get-count agrps))
(alert "No one group was found")
(progn
(setq i 0)
(vlax-for a agrps
(vl-catch-all-apply
(function (lambda()
(vla-delete a))))
(setq i (1+ i)))
(alert (strcat "Deleted " (itoa i) " groups"))))
(princ)
)
;(C:GDR)
and check out c:PUG, Purge Unused Groups, from: http://web2.airmail.net/terrycad/LISP/Groups.lsp
~'J'~
ccowgill
2006-11-20, 01:13 PM
I have a few questions, is grouping turned on? and if so, are all layers on and thawed, zoomed extents, then can you use the group dialog to show the group you are interested in? You can also delete groups in the group dialog box.
TobyKanoby
2006-11-20, 06:56 PM
I think you refer to removing objects from a group. I refer to the long list of group names that have been exploded or erased are still showing up in the dialogue list. Have they fixed this in Acad 2007?
I tested the functions above and the two that worked as I need are c: DeleteEmptyGroups and c:PUG. The function c:GDR did too much, but it did what it was programmed to do.
Thanks for your help.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.