An extremely useful routine, thanks CAB & all those that contributed.
I've noticed that 'eMaking' into another drawing however ignores objects originally drawn using linetypes and text styles that arent loaded in the new drawing. I've added a few more exceptions (see code) as a temporary fix.
If I ever get the time I may try including commands to re-define the text styles and load the relevant linetypes into a new drawing prior to processing all the entmakes.
(defun dxfstrip (ent / entl dxfx)
(setq entl (entget ent)
dxfx '(-2 -1 5 102 300 330 331 340 350 360 410)
;; additional codes to strip
dxfx (cond ((= (cdr (assoc 0 entl)) "DIMENSION")
(append dxfx '(2 210))
)
((= (cdr (assoc 0 entl)) "HATCH")
(append dxfx '(67))
)
((= (cdr (assoc 0 entl)) "INSERT")
(append dxfx '(40 41 42 43 44 45 50 71 210))
)
((= (cdr (assoc 0 entl)) "TEXT") ; remove text style, added by didge.
(append dxfx '(7))
)
((= (cdr (assoc 0 entl)) "LINE") ; remove linetype, added by didge.
(append dxfx '(6))
)
((= (cdr (assoc 0 entl)) "LWPOLYLINE") ; remove linetype, added by didge.
(append dxfx '(6))
)
(t (append dxfx '(210)))
)
entl (vl-remove-if '(lambda (pair) (member (car pair) dxfx)) entL)
)
;; CORRECTIONS FOR SPECIAL OBJECTS
(cond
;; Make Hatch Non-associative
((= (cdr (assoc 0 entl)) "HATCH")
(setq entl (replace '(71 . 0) '(71 . 1) entl))
(setq entl (replace '(97 . 0) (assoc 97 entl) entl))
(prompt "\n*** Warning Hatch created is Non-associative ***")
)
((= (cdr (assoc 0 entl)) "LEADER")
(prompt "\n*** Warning Leader created is Non-associative ***")
)
)
;; filter out objects that can not be created at this time
entl
) ; defun