Hi,
I found this code here for renaming drawings and it works great, thanks Kelie.
Is it possible to modify this code so that it can also be used on dxf files?
As it is now I get a double? extension on the renamed dxf file ie: *.dwg.dxf
I am new to lisp and have no idea where to start.
Thanks
;;;COMMAND: RENDWG
;;;FUNCTION: Save current drawing as a new one with user specified name and
;;; delete original drawing if successful.
;;;NOTES: Current drawing should have been saved prior to using this command.
;;;By: Kelie Feng, April 2006.
;;;
(defun C:RENDWG (/ *ERROR* app saveAsType doc oPath oDwgName dir nDwgName nPath)
(setq app (vlax-get-acad-object)
saveAsType (vla-get-saveastype
(vla-get-opensave
(vla-get-preferences app)
)
)
doc (vla-get-activedocument app)
oPath (vla-get-fullname doc)
oDwgName (vla-get-name doc)
dir (getvar "DWGPREFIX")
)
(setq nDwgName (getstring 1 "\nType new drawing name w/o extension: ")
nPath (strcat dir nDwgName ".dwg")
)
(if (or (not (findfile nPath))
(KF:Yes? nil
(strcat "File \"" nDwgName ".dwg\"" " exists. Overwrite?")
)
)
(if (not
(vl-catch-all-error-p
(vl-catch-all-apply
(function
(lambda ()
(vla-saveas doc nPath saveAsType)
(vl-file-delete oPath)
)
)
)
)
)
(prompt "\nDone.")
(prompt "\nRename/delete failed.")
)
)
(princ)
)
(defun KF:Yes? (default msg / input)
(initget "Yes No")
(setq input (getkword (strcat "\n"
msg
" [Yes/No] <"
(if default
"Y"
"N"
)
">: "
)
)
)
(cond
((= input "Yes") t)
((= input "No") nil)
(t default)
)
)
(princ)