Bad definition of XX at line XX of file xxxxx.lin

Here is a unique situation that I have run across a few times recently.

We have one shape file that we use for all of our complex linetypes. It’s name is “my-custom,shx”. Suddenly one day, a user cannot load linetypes, he gets this error:

Bad linetype dialog

Line 63 of the LIN file is a complex linetype that references the shape file “my-custom.shx”. Well, I know for a fact that the shape file is available, and I know there is no error in the LIN file.

NOTE: Before you read the rest of this, make sure that YOUR .lin file does not contain errors and that YOUR shape file is in the support file search path. If these two things are not true, then the rest of this article will not help anyway! One of these two things is most likely the answer to your issue. But if not, read on.

A review of the command history after opening this drawing reveals these two messages:

  • “my-custom.shx is a shape file, not a text font file.”
  • “Substituting [simplex.shx] for [my-custom.shx].”

So what is going on here?

The answer is that a textstyle exists in this drawing whose font-file is “my-custom.shx”. Under normal circumstances, you cannot choose a shape file as a font for a textstyle (we are still not sure how this is happening in these drawings – but regardless, it was).

The system variable FONTALT is used to specify a default font file in case the drawing encounters font files it cannot find. So when AutoCAD tried to load “my-custom.shx” as a font, it was smart enough to not do this (hence the error message “my-custom.shx is a shape file, not a font file”) – but apparently, whenever AutoCAD tries this substitution, it ruins future references to the shape file from that point on, in that session of AutoCAD. So when the user tried to load linetypes, it was looking for those shapes in Simplex.shx, instead of “my-custom.shx”

To fix this:

    • Set FONTALT to “.” (i.e. nothing)


    • Close AutoCAD.
    • Open AutoCAD.
    • Open the drawing in question.
    • When you get prompted for missing fonts, etc., just choose cancel.

Specify a font

  • After the drawing opens, run the STYLE command.
  • Review each textstyle and when you run across a style whose font is set to “my-custom.shx”, change it to a real font file (like “simplex.shx”)
  • When you are done, save the drawing and close AutoCAD.
  • Restart AutoCAD and load the drawing again.
  • Now try to load your linetypes once more.