Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please have a look at this lisp-script - it used to work and now it doesn't anymore. Not sure what happened between then and now. I am using AutoCAD 2016.
It's a life saver for me, to fix this irritating popup that tells me a SHX is missing. This lisp tells me where this shape-file is being used.
;; ------------------------------------------------------------------ ;; FNDSHAPE.LSP Copyright 2006 R.K. McSwain all rights reserved ;; ;; Author: R.K. McSwain ;; ;; Initial Release [27 FEB 2005] ;; ;; Feel free to copy, and modify as desired, just ;; retain this header and append as necessary. ;; ;; ;; ------------------------------------------------------------------ (defun c:fndshape (/ ENT LT OUTPUT SHPNST ST FN FP I INS ITEM LTENT LTNAME LTOBJ OBJ OSTR REF SHAPENM SHAPENO SHPN STENT STNAME STOBJ TMP ) (vl-load-com) (setq output '()) ; Step 1 - Find complex linetypes that reference a SHAPE (while (setq lt (tblnext "ltype" (not lt))) (setq ltname (cdr (assoc 2 lt))) (setq ltObj (tblobjname "ltype" ltname)) (setq ltEnt (entget ltObj)) (setq i 0) (while (< i (length ltEnt)) (setq item (nth i ltEnt)) (if (and (eq (car item) 74) (eq (cdr item) 4) ) (progn (setq shapeno (itoa (cdr (nth (1+ i) ltEnt)))) (setq shapenm (cdr (assoc 3 (entget (cdr (nth (+ i 2) ltEnt))))) ) (setq ostr (strcat "LINETYPE [" ltname "] uses SHAPE # [" shapeno "] in the file [" shapenm "]" ) ) (setq output (cons ostr output) i 10000 ) ) ) (setq i (1+ i)) ) ) ; Step 2 - Find loaded SHAPE FILES (while (setq st (tblnext "style" (not st))) (setq stname (cdr (assoc 2 st))) (setq stObj (tblobjname "style" stname)) (setq stEnt (entget stObj)) (if (eq 1 (logand (cdr (assoc 70 stEnt)) 1)) (setq ostr (strcat "The following SHAPE FILE is loaded: [" (vl-princ-to-string (cdr (assoc 3 st))) "]" ) output (cons ostr output) ) ) (setq i (1+ i)) ) ; Step 3 - Find inserted SHAPES (setq tmp (ssget "X" '((0 . "SHAPE")))) (if tmp (progn (setq i 0) (while (< i (sslength tmp)) (setq obj (ssname tmp i)) (setq ent (entget obj)) (setq shpn (cdr (assoc 2 ent))) (if (not shpn) (setq shpnST "An unknown shape ") (setq shpnST (strcat "SHAPE named " shpn "] ")) ) (setq ins (cdr (assoc 10 ent))) (setq ref (cdr (assoc 2 (entget (cdr (assoc 330 ent)))))) (setq ostr (strcat shpnST "is INSERTED in " ref " at " (vl-princ-to-string ins) ) ) (setq output (cons ostr output)) (setq i (1+ i)) ) ) ) (if output (progn (setq output (reverse output)) (setq fn (strcat (getenv "temp") "\\fndshape.txt")) (setq fp (open fn "w")) (foreach item output (write-line item fp) ) (close fp) (startapp "notepad" fn) ) (alert "Nothing found") ) (princ) ) (princ "\n Type FNDSHAPE to run...") (princ)
Solved! Go to Solution.