Antonella Posted October 27, 2015 Share Posted October 27, 2015 Hi everybody, My problem: a big amount of files I have to work on don’t show, nor print properly batting linetype because of a temporary corruption of the file ACADISO.LIN due to the insertion/xref of some consultant drawings (it isn’t fixable just changing the .lin file!). This temporary corruption happens every time in autocad is opened a corrupted file. The slow solution: I found how to fix it changing the missing font (usually ltypeshp.shx) in the text style windows here: http://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Bad-definition-of-FENCELINE1-at-line-XXX-when-loading-a-linetype.html But it’s necessary to do it on every single drawing, and also several times, if also all the xref are not fixed, and every time there are new drawings from consultants... NIGHTMARE!!! THE DESIRED SOLUTION: a LISP able to change/replace all the missing fonts according the slow solution automatically. Or whatever it comes to your mind to solve quickly this problem! Can any of you help me please? I would really appreciate!!! Quote Link to comment Share on other sites More sharing options...
T-Lo Posted January 20, 2020 Share Posted January 20, 2020 Hi I know this thread is super old, but I had the same situation and I solved it with a combination of this LISP from AKN (props to hmsilva): https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-custom-lisp-that-searches-for-specific-font-within-a-style/td-p/5654350 (vl-load-com) ;; To replace font file in a text style. ;; usage ;; (repl_font "ltypeshp.shx" "simplex.shx") (defun repl_font (old new /) (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) stls (vla-get-textstyles acdoc) ) (if (or (setq file (findfile new)) (setq file (findfile (strcat (getenv "systemroot") "\\Fonts\\" new))) ) (vlax-for stl stls (if (= (vla-get-fontfile stl) old) (vla-put-fontfile stl file) ) ) ) ) (repl_font "ltypeshp.shx" "romans.shx") And then use Lee Mac's "ScriptWriter" to create a script that could be run on a whole folder of files: http://www.lee-mac.com/scriptwriter.html Quote Link to comment Share on other sites More sharing options...
guran Posted January 20, 2020 Share Posted January 20, 2020 FONTALT (System Variable) Specifies the alternate font to be used when the specified font file cannot be located. Quote Link to comment Share on other sites More sharing options...
T-Lo Posted January 20, 2020 Share Posted January 20, 2020 (edited) Let me clarify: typically when this situation occurs, it's because someone assigned the LTYPESHP.SHX file to a textstyle in your drawing. LTYPESHP.SHX is NOT a font file - it is a complex linetype file which ships standard with AutoCAD and unless you delete it from your hard drive, it can usually be found here (for AutoCAD 2020): C:\Users\<me>\AppData\Roaming\Autodesk\AutoCAD 2020\R23.1\enu\Support This means that the LTYPESHP.SHX linetype file does exist in your search path (i.e. it is not missing - therefore FONTALT doesn't work in this instance). But since someone assigned it to a textstyle, this prevents LTYPESHP.SHX from loading correctly when you try to load linetypes via the LTYPE command (hence, the errors that it "can't find" FENCLINE1, FENCELINE2, BATTING, etc. - which are the linetypes defined in LTYPESHP.SHX). Therefore, the fix is to find the offending textstyle(s) in your drawing which are using LTYPESHP.SHX as the font, and assign it to be a real font (e.g. romans.shx). The AKN article that the OP linked to, addresses this scenario exactly, and that is the scenario I also had, which my suggested solution fixed for me. The lisp routine automates redefining the font and the ScriptWriter utility allows you to create a script so you can batch process multiple drawing files with that lisp routine. Edited January 20, 2020 by T-Lo Quote Link to comment Share on other sites More sharing options...
ronjonp Posted January 20, 2020 Share Posted January 20, 2020 @T-Lo Do you realize that this question was asked over 4 years ago? Welcome to CadTutor! Quote Link to comment Share on other sites More sharing options...
T-Lo Posted January 20, 2020 Share Posted January 20, 2020 Hi RonJonP, Yes, lol, I'm aware this is an old post. Looks like the OP never posted anything else on CADtutor after not receiving an answer to his/her question. Makes it a bit less of a useless thread if it can help someone else out who may stumble on this, for posterity Quote Link to comment Share on other sites More sharing options...
ronjonp Posted January 20, 2020 Share Posted January 20, 2020 (edited) 2 hours ago, T-Lo said: Hi I know this thread is super old, but .. Guess I should have read your post a bit closer. FWIW, you might want to force uppercase on your check of the old font file: (if (= (strcase (vla-get-fontfile stl)) (strcase old))) Will fail: (= "simplex.shx" "Simplex.shx") Edited January 20, 2020 by ronjonp Quote Link to comment Share on other sites More sharing options...
T-Lo Posted January 20, 2020 Share Posted January 20, 2020 ronjonp, Thanks for the hint! strange though, it worked fine for me as all lowercase. But with all things ACAD, ymmv, and this could be just the thing to get someone else out of a pickle Quote Link to comment Share on other sites More sharing options...
Moliveira Posted March 15, 2020 Share Posted March 15, 2020 On 1/20/2020 at 2:45 PM, T-Lo said: Hi I know this thread is super old, but I had the same situation and I solved it with a combination of this LISP from AKN (props to hmsilva): https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-custom-lisp-that-searches-for-specific-font-within-a-style/td-p/5654350 (vl-load-com) ;; To replace font file in a text style. ;; usage ;; (repl_font "ltypeshp.shx" "simplex.shx") (defun repl_font (old new /) (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) stls (vla-get-textstyles acdoc) ) (if (or (setq file (findfile new)) (setq file (findfile (strcat (getenv "systemroot") "\\Fonts\\" new))) ) (vlax-for stl stls (if (= (vla-get-fontfile stl) old) (vla-put-fontfile stl file) ) ) ) ) (repl_font "ltypeshp.shx" "romans.shx") And then use Lee Mac's "ScriptWriter" to create a script that could be run on a whole folder of files: http://www.lee-mac.com/scriptwriter.html T-Lo can you share the script you used from Lee Mac's and how it works? I already used the lisp you posted and it works, but the script is the next step and I cant get that far!! Cheers, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.