save new file to pre-determined location but with new name

save new file to pre-determined location but with new name

eharrisonTZS2M
Enthusiast Enthusiast
173 Views
1 Reply
Message 1 of 2

save new file to pre-determined location but with new name

eharrisonTZS2M
Enthusiast
Enthusiast

i have the following LISP to create a DXF, but the problem is, this LISP runs on whatever the file name is, regardless if it is saved or not. in a perfect world, my file would be saved, and i can get the proper location if my file is already saved. but what i'm wanting to do is to copy my object to a new drawing and run this lisp to create it as a dxf, but i want it to ask me what to name the file, so what do i replace ------ (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4))------ with to be able to customize the file name each time i run my LISP? I'd rather not change the LISP code if at all possible, just this particular section.

-----------------------------------------------------------------------

 

(defun c:DXF ( / fileName)
 
 
(vl-load-com)
  (vlax-for layout (vla-get-layouts
    (vla-get-ActiveDocument (vlax-get-acad-object))
   )
 
       (if (/= (vla-get-name layout) "Model")
         (vla-delete layout)
       )
     )
 
        (command "._change" "all" "" "properties" "layer" "0" "")
        (command "._-purge" "all" "" "no")
 
(vla-saveas
   (vla-get-activedocument (vlax-get-acad-object))
   (strcat "F:\\mazak -NEO\\" (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)) ".dxf")
   ac2000_dxf)
 
 
 (princ)
)
 
----------------------------------------------------------------------------------------------
 
0 Likes
174 Views
1 Reply
Reply (1)
Message 2 of 2

paullimapa
Mentor
Mentor

If you want to learn a bit of Autolisp specifically the getfiled function to allow you to enter a new file name at a specific folder location with Dxf extension then you can read up on it here

http://autolisp-kishore.blogspot.com/2013/06/getfiled-function-in-autolisp_1315.html?m=1


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes