;;;Detach selected XREF. ;;; ;;; Author: ;;; Henry C. Francis ;;; 425 N. Ashe St. ;;; Southern Pines, NC 28387 ;;; ;;; http://www.paracadd.com ;;; All rights reserved. ;;; (DEFUN c:xrdet (/ rtnswp) (IF (= "INSERT" (CDR (ASSOC 0 (ENTGET (CAR (SETQ xrent (ENTSEL "\nPick XREF to detach. "))) ) ;_ end of ENTGET ) ;_ end of assoc ) ;_ end of cdr ) ;_ end of = (PROGN (SETQ xrname (CDR (ASSOC 2 (ENTGET (CAR xrent))))) (IF (WCMATCH xrname "*`@*,*`#*,*`.*,*`~*") (PROGN (SETQ orig-xrname xrname) (SETQ scxrname NIL) (IF (WCMATCH xrname "*`@*") (PROGN (SETQ xrncnt 1 scxrname xrname ) (WHILE (NOT (WCMATCH (SUBSTR xrname xrncnt) "`@*")) (SETQ xrncnt (1+ xrncnt)) ) (COND ((EQ xrncnt 1) (SETQ scxrname (STRCAT "`" scxrname))) (T (SETQ scxrname (STRCAT (SUBSTR xrname 1 (1- xrncnt)) "`" (SUBSTR xrname xrncnt)))) ) ) ) (IF scxrname (SETQ xrname scxrname)) (IF (WCMATCH xrname "*`#*") (PROGN (SETQ xrncnt 1 scxrname xrname ) (WHILE (NOT (WCMATCH (SUBSTR xrname xrncnt) "`#*")) (SETQ xrncnt (1+ xrncnt)) ) (COND ((EQ xrncnt 1) (SETQ scxrname (STRCAT "`" scxrname))) (T (SETQ scxrname (STRCAT (SUBSTR xrname 1 (1- xrncnt)) "`" (SUBSTR xrname xrncnt)))) ) ) ) (IF scxrname (SETQ xrname scxrname)) (IF (WCMATCH xrname "*`.*") (PROGN (SETQ xrncnt 1 scxrname xrname ) (WHILE (NOT (WCMATCH (SUBSTR xrname xrncnt) "`.*")) (SETQ xrncnt (1+ xrncnt)) ) (COND ((EQ xrncnt 1) (SETQ scxrname (STRCAT "`" scxrname))) (T (SETQ scxrname (STRCAT (SUBSTR xrname 1 (1- xrncnt)) "`" (SUBSTR xrname xrncnt)))) ) ) ) (IF scxrname (SETQ xrname scxrname)) (IF (WCMATCH xrname "*`~*") (PROGN (SETQ xrncnt 1 scxrname xrname ) (WHILE (NOT (WCMATCH (SUBSTR xrname xrncnt) "`~*")) (SETQ xrncnt (1+ xrncnt)) ) (COND ((EQ xrncnt 1) (SETQ scxrname (STRCAT "`" scxrname))) (T (SETQ scxrname (STRCAT (SUBSTR xrname 1 (1- xrncnt)) "`" (SUBSTR xrname xrncnt)))) ) ) ) (SETQ xrname orig-xrname xrfins (SSGET "X" (LIST (CONS 2 scxrname))) xrfcnt (SSLENGTH xrfins) ) ) (SETQ scxrname NIL xrfins (SSGET "X" (LIST (CONS 2 xrname))) xrfcnt (SSLENGTH xrfins) ) ) (TBLNEXT "block" T) (SETQ tblent (TBLSEARCH "block" xrname)) (IF (AND (EQ xrfcnt 1)(= (REM (CDR (ASSOC 70 tblent)) 4) 0)) (progn (COMMAND ".xref" "detach" (IF scxrname scxrname xrname)) (princ (STRCAT "\nXref " xrname " has been detached. ")) (princ) ) (COND ((> xrfcnt 1)(PRINC (STRCAT "\nXref \"" xrname "\" has multiple references. Not detached."))) (T (PRINC "\nNot an XREF. ")) ) ) ;_ end of IF ) ;_ end of PROGN (PRINC "\nNot an XREF. ") ) ;_ end of IF (PRINC) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 2 0 0 T T nil T) ***Don't add text below the comment!***|;