GregGleason Posted December 1, 2017 Posted December 1, 2017 I have this snippet of code where you can output a file: (if (setq fn (getfiled "Save layer list as" (strcat (vl-filename-base (getvar "dwgname")) ".txt") "txt" 1 ) ) (if (layer-list-fprint fn) (princ "\nLayer list created.") (princ "\nError: Layer list not created!") ) ) (princ) What I want to do is to automatically output a text file with the file name the same as the .dwg (but with a ".txt" extension) and overwrite an existing file in one exists. Can I do that without the dialog? Greg Quote
BIGAL Posted December 1, 2017 Posted December 1, 2017 Getfiled is calling the dialog box, look at (getvar "dwgprefix") you can hard code the txt file to be in the same place as the dwg or put it where ever you like. (setq fname (strcat (getvar "dwgprefix") (getvar "dwgname") ".txt")) another example ; check that pdf directory exists (setq dwgpre (strcat (getvar "dwgprefix") "\pdf")) (if (= (vl-file-directory-p dwgpre) nil) (vl-mkdir dwgpre) ) (setq pdfname (strcat (getvar "dwgprefix") "pdf\\" dwgname "-" (getvar "ctab"))) Quote
GregGleason Posted December 2, 2017 Author Posted December 2, 2017 That worked great BIGAL and thanks! Also, I appreciate the bonus code. Greg Quote
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.