AutoLISP: Purge Missing SHX files

If you have drawings that are constantly missing SHX (shape) files, the routine posted below is now your friend.

The routine was posted in the LISP forum at CADTutor at the following link. Please refer questions there.

Here’s how:

  • PSHX <enter>

The result in the command line will show how many unresolved shape files were removed from the drawing.

Missing SHX 1 Missing SHX2Thanks for sharing this routine Kheylan

;; posted by: Kheylan
;; Downloaded from CADTutor forum

(defun C:PSHX ()

  (vlax-for item
           (vla-get-ActiveDocument (vlax-get-acad-object))
    (vl-filename-extension (setq fname (vla-get-fontfile item)))
       (setq fname (strcat fname ".shx"))
    (cond ((findfile fname) nil)
      ((findfile (strcat (getenv "WINDIR") "\\FONTS\\" fname))
       (vla-put-fontfile item "ltypeshp.shx")
       (princ "\nChange ")
       (princ fname)
       (princ " on ltypeshp.shx")
;(princ "\nPurge unreferenced shape files, Lisp Command : PSHX")
About these ads

About AutoCAD Tips

As weird as it sounds, AutoCAD is a hobby for me. But I am fortunate enough to have a career doing my hobby. I work for a large engineering firm supporting CAD users in various disciplines. My dream job would be to work for a company like Autodesk or Disney's Imagineering where inspiring others and using innovative approaches and software are adding value to projects and bringing design in all areas up to a new level. This blog serves as a repository or knowledge base for myself so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting experience better.
This entry was posted in AutoLISP, AutoLISP: Manage, Linetypes, Manage. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s