As my friend Marc suggests, experiment on copies of the afflicted drawing.
The following makes it easier to select dictionaries to delete, noting the results (good/bad) on the resulting drawing. Be careful, nuking dictionaries with wild abandon can lead to disastrous results. For example, if one deletes KS_SHAPEREF* dictionaries one will be in for a world of pain as hundreds of dialogs will be thrown when opening the drawing. tl;dr: Use judiciously.
(defun c:NukeDics ( / _GetDicsAsNamesAndEnames dic_data selected )
;; c:NukeDics.lsp, Version 1.0 2016-05-27.
;;
;; Trivial code, nonetheless: Copyright © 2016 Michael Puckett
;;
;; Provided as is, complete with errors, omissions and various
;; terminal diseases. User must accept all responsibilty for
;; consequences resulting from the use of this utility which
;; is provided solely as a gift to the CAD community.
(cond
( (null dos_checklist)
(princ
(strcat
"\nSorry, this utility uses DOSLIB which does "
"not appear to be loaded. See www.mcneel.com."
)
)
)
( (progn (vl-load-com) nil))
( (null
(defun _GetDicsAsNamesAndEnames ( dic )
( (lambda ( filter data ) (mapcar 'list (filter 3 data) (filter 350 data)))
(lambda (k d) (mapcar 'cdr (vl-remove-if-not '(lambda (p) (eq k (car p))) d)))
(entget (if (eq 'vla-object (type dic)) (vlax-vla-object->ename dic) dic))
)
)
)
)
( (null
(setq dic_data
(_GetDicsAsNamesAndEnames
(vla-get-dictionaries
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
)
)
(princ "\nOdd, this dwg appears to be dicless.")
)
( (null
(setq selected
(vl-remove-if-not
(function (lambda (p) (eq 1 (cdr p))))
(dos_checklist
"Nuke Dictionaries:"
"Select dictionaries to nuke:"
(mapcar
(function (lambda (p) (cons (car p) 0)))
(setq dic_data
(vl-sort dic_data
(function (lambda (a b) (< (car a ) (car b))))
)
)
)
)
)
)
)
(princ "\nNo dics selected for deletion.")
)
( (foreach key (mapcar 'car selected)
(vl-catch-all-apply 'entdel (setq l (cdr (assoc key dic_data))))
(princ
(strcat
"\n"
key
(if (vlax-erased-p (car l))
" [deleted]"
" [delete attempt failed]"
)
)
)
)
)
)
(princ)
)