Building on your code, and just for fun:
- (defun c:XRL2 ( / ss l) (if (setq ss (ssget "_x" (list '(0 . "INSERT") (cons 8 (strcat "~" (setq l "G-XREF")))))) ((lambda (i / e n) (while (setq e (entget (ssname ss (setq i (1+ i))))) (if (and (= 4 (logand 4 (cdr (assoc 70 (tblsearch "block" (cdr (assoc 2 e))))))) (= 0 (cdr (assoc 70 (entget (tblobjname "layer" (cdr (setq n (assoc 8 e))))))))) (entmod (subst (cons 8 l) n e))))) -1) (prompt "\n** Nothing selected ** ")) (princ))
- (defun c:XRL3 ( / dxf ss l) (defun dxf (n eData) (if (and (= 'INT (type n)) (listp eData)) (cdr (assoc n eData)) (prompt "\n** "DXF" error: Invalid argument ** "))) (if (setq ss (ssget "_x" (list '(0 . "INSERT") (cons 8 (strcat "~" (setq l "G-XREF")))))) ((lambda (i / e) (while (setq e (entget (ssname ss (setq i (1+ i))))) (if (and (= 4 (logand 4 (dxf 70 (tblsearch "block" (dxf 2 e))))) (= 0 (dxf 70 (entget (tblobjname "layer" (dxf 8 e)))))) (entmod (subst (cons 8 l) (assoc 8 e) e))))) -1) (prompt "\n** Nothing selected ** ")) (princ))
|