;;; Arc+ Dimension and Hatch Blocks Separator
;;; Modified by Igal Averbuh 2016
;;; Based on: http://www.cadtutor.net/forum/showthread.php?89306-Lisp-to-select-blocks-using-wildcard

(defun c:dbe ( / i p q s )
(setq p "hatch*" ;; Block name pattern
p (strcase p)
)
(if (setq s (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," p)))))
(repeat (setq i (sslength s))
(if (not (wcmatch (strcase (LM:blockname (vlax-ename->vla-object (ssname s (setq i (1- i)))))) p))
(ssdel (ssname s i) s)
)
)
)
(if (and s (vla-object (ssname s (setq i (1- i)))))) p))
(ssdel (ssname s i) s)
)
)
)
(if (and s (< 0 (sslength s)))
(progn
(setq q (getvar 'qaflags))
(setvar 'qaflags 0)

(command "-layer" "n" "0-DIM" "C" "242" "0-DIM" "")

(command ".CHPROP" S "" "LA" "0-DIM" "") ; Change dimensions to layer

; (command "_.erase" s "")
(setvar 'qaflags 0)
)
)
(princ)
)

(defun c:dhb ( /)
(c:dbe)
(c:dbd)
)
(c:dhb)

Advertisements