RBrigido Posted July 20, 2023 Posted July 20, 2023 Hi guys, How's the farm? I'm having a headache here with a simple lisp that I can't fix. Just to let you know, I'm using BricsCAD. See the code below: Quote (defun c:SaveAsUserDefined () (vl-load-com) ; Load the COM (Component Object Model) functions for AutoCAD ; Prompt the user for the new location and file name (setq new-file (getfiled "Save as" "" "dwg" 16)) ; Check if the user selected a valid location/name (if new-file (progn ; Save the current drawing as the new file (vla-SaveAs (vla-get-activedocument (vlax-get-acad-object)) new-file) (princ (strcat "\nDrawing saved as: " new-file)) ) (princ "\nOperation canceled by the user.") ) (princ) ) I don't know why, when I try to use that lisp, I'm not be able to change the extension. A window appears asking me to save in some location, I choose and put a name, see below: But when it's save, always is as .DXF extension. Any ideas? Quote
SLW210 Posted July 20, 2023 Posted July 20, 2023 Works in AutoCAD 2022. Drawing saved as: C:\SLW LISP_CAD Files\DCL Testing\Testing.dwg Quote
BIGAL Posted July 21, 2023 Posted July 21, 2023 Maybe use (command "saveas" .... it will ask for extra details. 1 Quote
Steven P Posted July 21, 2023 Posted July 21, 2023 This is the similar line I use, I have the version at the end of it, not sure if that makes a difference? BricsCAD can be funny sometimes with VLA - commands I believe. (vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat (getvar "dwgprefix") myfilename ".dwg") ac2010_dwg) (One of our clients lives in the past with ac2010, maybe I should update this one day) 1 Quote
marko_ribar Posted July 21, 2023 Posted July 21, 2023 For opening files : (setq new-file (getfiled "Save as" "" "dwg" 16)) For saving files : (setq new-file (getfiled "Save as" "" "dwg" 1)) Quote
RBrigido Posted July 24, 2023 Author Posted July 24, 2023 Hi guys, Thanks for all your reply. @Steven P's answer was pretty resolute for me. If you have BricsCAD or have the same problem with AutoCAD, I'll be sharing the Lisp Routine below: Quote (defun c:zzzzzz() (vl-load-com) ; Load COM (Component Object Model) functions into AutoCAD ; Prompt the user for the new location and name of the file (setq new-file (getfiled "Save as" "" "dwg" 16)) ; Check if the user selected a valid location/name (if new-file (progn ; Save the current drawing as the new file (vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) new-file ac2010_dwg) (princ (strcat "\nDrawing saved as: " new-file)) ) (princ "\nOperation canceled by the user.") ) (prince) ) Thank you all for try to help me !! Best wishes, Rodrigo Brigido. 1 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.