PDA

View Full Version : Saveas new format issue


prose
2008-11-17, 09:15 PM
Can someone please tell me what I am doing wrong or missing.
I am trying to saveas the current file in 2000 format in the same location with the same name but adding "_version2000" at the end.


(defun C:GetReadyToEmail ()
(setq fdd (getvar "filedia"))
(command "filedia" "0")
(setq fn(strcat (getvar "dwgprefix")(getvar"dwgname") "_version2000"))
(command "saveas" "2000" fn)
(command "filedia" fdd)
)


Any ideas?

ccowgill
2008-11-17, 09:40 PM
Can someone please tell me what I am doing wrong or missing.
I am trying to saveas the current file in 2000 format in the same location with the same name but adding "_version2000" at the end.


(defun C:GetReadyToEmail ()
(setq fdd (getvar "filedia"))
(command "filedia" "0")
(setq fn(strcat (getvar "dwgprefix")(getvar"dwgname") "_version2000"))
(command "saveas" "2000" fn)
(command "filedia" fdd)
)
Any ideas?
what is not working?
do you need to trim off the .dwg from the end of the dwgname?
Try this:

(vl-load-com)
(defun C:GetReadyToEmail (/ fdd fn)
(setq fdd (getvar "filedia"))
(command "filedia" "0")
(setq fn(strcat (getvar "dwgprefix")(vl-filename-base(getvar"dwgname")) "_version2000"))
(command "saveas" "2000" fn)
(command "filedia" fdd)
)

prose
2008-11-17, 09:45 PM
That worked wonderfully.
Thanks.
The knowledge on this site never ceases to amaze me.

irneb
2008-11-18, 03:56 PM
Just as a tip. Try not using (command ...) to set sysvars. Rather use (setvar ...). E.g. (setvar "filedia" 0) and (setvar "filedia" fdd) will do the same but won't be mirrored to the command line.