A handy LISP routine to delete all white hatching (equal to colour number 7 or 255)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
A handy LISP routine that will delete all white hatching equal to colour number 7 or 255.
it was taking me too long to open drawings and delete large white hatched areas using traditional methods so i just thought id share this lisp i wrote the other day for deleting all hatching of a particular colour in the dwg, it can be easily modified to change or add colours.
any questions feel free to ask!
" (defun c:dwh ()
(vl-load-com) ; load the Visual LISP ActiveX interface
(setq ss (ssget "X" '((0 . "HATCH")))) ; select all hatches in the drawing
(if ss ; if the selection set is not nil
(progn ; do the following
(setq i 0) ; initialize a counter
(repeat (sslength ss) ; loop through the selection set
(setq ent (vlax-ename->vla-object (ssname ss i))) ; get the hatch object
(if (or (= (vla-get-Color ent) 7) ; if the hatch color is white
(= (vla-get-Color ent) 255) ; or if the hatch color is 255
) ; end or
(vla-delete ent) ; delete the hatch object
) ; end if
(setq i (1+ i)) ; increment the counter
) ; end repeat
) ; end progn
) ; end if
(princ) ; exit quietly
) ; end defun "