When you send an AutoCAD drawing off to other users, it’s good practice to use the Pack and Go or eTransmit to bundle up all the associated files (xrefs, fonts, etc.). Sadly, not everyone is well-versed in file transfer etiquette, and you may find yourself the recipient of a drawing that’s missing some shape (SHX) files. This problem can also occur when you misplace or delete the SHX files.
Note that AutoCAD uses two kinds of SHX files. AutoCAD fonts are compiled as SHX files. However, you are most likely being prompted to find a shape file. Shape files are objects, similar to blocks, that are usually part of a linetype definition.
Every time you open such a drawing, you will be prompted to find those missing files. The first solution is to locate the missing SHX files. If the drawing came from an outside source, ask that source to send the missing files. If it’s an internal drawing, search your computer and servers for the missing file. You can find the name in file name box in the Select Shape File dialog box that appears when you open the drawing.
If you can’t locate the missing file, you can try to remove the missing shape from the drawing. Do this only if you are sure that removing the shape won’t affect the integrity of the drawing. Also do this only on a copy of the drawing in case you are mistaken about the effects of removing the shape.
First, try running the Purge command. If the shape is not listed, check your complex linetypes. Try purging all linetypes, then see if the shape file is listed.
If that doesn’t work, run Qselect and see if any Shape entities appear in the drawing. If they do, you can select and delete them.
If that doesn’t work, here’s an AutoLISP routine provided by Autodesk that erases shape objects that reference unavailable shape files and purges references to unavailable shape files. Create a new text file in a text editor such as Notepad and paste in the following:
;;;---------------- 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 use the Appload command to load the routine in AutoCAD. Type Delshape at the command line. When it’s done, the routine will display the number of shapes erased and the number of shape files purged at the command line. It will delete only shapes that reference unavailable shape files. It won’t delete shapes that display. |