Michaels Posted October 24, 2010 Posted October 24, 2010 Hello, How to save my dwg to the drive D and to specific folder . for example called My Folder. (setq Fname (getstring T "\n new file name :")) (setq x (strcat [b][color="red"]"D:\\My Folder\\"[/color][/b] Fname ".dwg")) Why the above file path is not working ? Thanks Quote
JohnM Posted October 24, 2010 Posted October 24, 2010 please post the rest of the code so we can see what's going on Quote
Michaels Posted October 24, 2010 Author Posted October 24, 2010 Yes Lee the "My Folder" is already made or existed in drive D. Mr Johnm. Here are the codes nothings more than that up to this moment . (if (and (setq Fname (getstring T "\n new file name :")) (setq x (strcat "D:\\My Folder\\" Fname ".dwg")) ) (command "_.save" x) (princ) ) By Mr Lee 's question, Is it possible also to create a folder before save the dwg and include it within ? many thanks for you all. Quote
Lee Mac Posted October 24, 2010 Posted October 24, 2010 Perhaps something like this... (defun c:test ( / dir file ) (setq dir "D:\\My Folder") (vl-mkdir dir) (if (and (vl-file-directory-p dir) (snvalid (setq file (getstring t "\nEnter Filename: "))) ) (vla-saveas (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat dir "\\" file ".dwg") ) ) (princ) ) Quote
Michaels Posted October 24, 2010 Author Posted October 24, 2010 Perhaps something like this... (defun c:test ( / dir file ) (setq dir "D:\\My Folder") (vl-mkdir dir) (if (and (vl-file-directory-p dir) (snvalid (setq file (getstring t "\nEnter Filename: "))) ) (vla-saveas (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat dir "\\" file) )) (princ)) What a great work Lee. That's really amazing and wonderful. one question please about (snvalid). I've read about it but I couldn't understand it well ? Thank you so much. Michaels Quote
Lee Mac Posted October 24, 2010 Posted October 24, 2010 Thanks Michaels snvalid checks whether the string is valid for use as a symbol table name, hence it checks for characters such as /\?*" etc - the help files document it better. (BTW, I updated the code above to include the .dwg extension) Quote
Michaels Posted October 24, 2010 Author Posted October 24, 2010 (BTW, I updated the code above to include the .dwg extension) That's right. The first code that you posted before post 5 and re update it within the same reply , it did not work because it was (saveas) and I tried it with (save) command only and it was as great as the the last undated one. Thank you so much Lee. Quote
Tiger Posted October 25, 2010 Posted October 25, 2010 Further on Lee's teaching career see This Thread. 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.