Erase shapes and purge references to unavailable shape (SHX) files Issue
Every time you open a drawing that references shape files that are not on your system, a dialog box is displayed and you are prompted to locate missing shape (SHX) files. Solution
This problem can occur when you receive drawings from other users, and the associated shape files are not provided with the drawing.
Warning: This solution permanently and irreversibly removes missing shape objects from the drawing. Do not use this solution unless you are sure you can remove the missing shape objects without affecting the validity of the drawing.
The best way to resolve this problem is to obtain the missing shape files. However, they might be unavailable. This solution is for situations where you are unable to obtain the missing shape files, and you know you can remove them without affecting the validity of the drawing. The solution provides an AutoLISP® routine that you can use to
- Erase shape objects that reference unavailable shape files.
- Purge references to unavailable shape files.
You can then load the drawing without error.
- Use a text editor (for example, Microsoft® Notepad) to create a new text file.
- Copy and paste the following AutoLISP code into the text file created in the previous step.
;;;-------------------- START OF FILE ------------------------
;;;--------------------------------------------------------------------------;
;;; DESCRIPTION ;;; This routine deletes all shapes in the drawing ;;; that do not have a file definition. ;;; ;;; RUN ;;; -load this file and run the new command DELSHAPE ;;;--------------------------------------------------------------------------;
(defun c:delshape () (setvar "CMDECHO" 0) (setq n 0 nshapes 0 delete 0 ) (setq shapes (ssget "X" '((0 . "SHAPE")))) ;shapes (setq shapes_name (ssget "X" (list (cons 0 "SHAPE") (cons 2 "*")))) (if (/= shapes nil) (setq nshapes (sslength shapes)) ) ; n. total de shapes (if (and (= shapes_name nil) (/= shapes nil)) (progn (while (< n nshapes) (setq entity (ssname shapes n)) (entdel entity) (setq delete (+ 1 delete)) (setq n (+ 1 n)) ) ) ) (while (and (< n nshapes) (/= shapes nil) (/= shapes_name nil)) (setq entity (ssname shapes n)) (if (or (= (ssmemb entity shapes_name) nil)) (progn (entdel entity) (setq delete (+ 1 delete)) ) ) (setq n (+ 1 n)) ) (prin1 delete) (princ " shape(s) deleted\n") (command "_purge" "_sh" "" "_n") ) ;;---------------- END OF FILE --------------
- Save the text file as delshape.lsp, and exit the text editor.
- Open the problem drawing, and use the APPLOAD command to load the delshape.lsp routine.
- On the command line, enter delshape. The routine runs and returns the following information on the command line:
Number of shapes erased Names of the shape files purged
- Save the drawing.
Note: This routine only deletes shapes in the drawing that reference unavailable shape files. The routine does not delete shapes displayed in the drawing.
Tip: Use the eTransmit utility to avoid this kind of problem in the future. The eTransmit utility copies all files associated with a drawing to a specified location, and those files can then be submitted with the drawing.
Give us your feedback on this document:
AUTODESK DOES NOT GUARANTEE THAT YOU WILL BE ABLE TO SUCCESSFULLY DOWNLOAD OR IMPLEMENT ANY SERVICE PACK OR WORKAROUND, OR ANY OF THE TIPS, TRICKS, EXAMPLES OR SUGGESTIONS OUTLINED IN ANY AUTODESK PRODUCT SUPPORT TECHNICAL DOCUMENTS. TECHNICAL DOCUMENTS, SERVICE PACKS AND WORKAROUNDS ARE SUBJECT TO CHANGE WITHOUT NOTICE TO YOU. AUTODESK PROVIDES TECHNICAL DOCUMENTS, SERVICE PACKS AND WORKAROUNDS "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL AUTODESK OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF DATA, OR LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, THAT MAY OCCUR AS A RESULT OF IMPLEMENTING ANY SERVICE PACK OR WORKAROUND, OR ANY SUGGESTION OUTLINED IN ANY AUTODESK PRODUCT SUPPORT TECHNICAL DOCUMENT, EVEN IF AUTODESK OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |