I'd look into the DXFOUT command in lieu of saveas
Also you will need \\ or use / for directory locations in lieu of the single \
-David

Registered forum members do not see this ad.
Trying to get this lisp to save a dxf to a specific folder ex. C:\My Documents\DXF\. I tryed putting that in the code but I'm not writing it right or something. Could someone point me in the right direction.
Code:(defun c:dxf () (vl-load-com) (vlax-for LAYOUT (vla-get-layouts(vla-get-activedocument(vlax-get-acad-object))) (vl-catch-all-apply 'vla-delete (list LAYOUT)) ) (command "CHANGE" "ALL" "" "P" "LA" "0" "") (command "-PURGE" "ALL" "" "N") (nowdxf) ) (defun nowdxf () (command "saveas" "dxf" "") )
I'd look into the DXFOUT command in lieu of saveas
Also you will need \\ or use / for directory locations in lieu of the single \
-David
R12 (Dos) - A2K

Tryed this. Its still not working. By usings just the saveas or dxfout, it works but I want to force it to this folder with out have to select it.
Code:(defun c:dxf () (vl-load-com) (vlax-for LAYOUT (vla-get-layouts(vla-get-activedocument(vlax-get-acad-object))) (vl-catch-all-apply 'vla-delete (list LAYOUT)) ) (setvar "CLAYER" "0") (command "change" "all" "" "p" "la" "0" "") (command "-purge" "all" "" "n") (nowdxf) ) (defun nowdxf (/ dxfname) (setq dxfname (getstring "n\DXF Name: ")) (command "_SAVEAS" "DXF" "" (strcat "C:\\Users\\My Documents\\DXF\\" DXFNAME)) (princ) )
If you're trying to avoid the SaveAs dialog, then consider this example:
Code:(defun c:FOO ( / fileName) (vl-load-com) (if (setq fileName (getstring T "\nEnter a file name: ")) (vla-saveas (vla-get-activedocument (vlax-get-acad-object)) (strcat "C:\\Users\\My Documents\\DXF\\" fileName ".dxf") ac2010_dxf) ) (princ) )
"Potential has a shelf life." - Margaret Atwood
Oh - Almost forgot... For reference: ActiveX SaveAs Method
"Potential has a shelf life." - Margaret Atwood

Thanks. It works perfect

How different would this code look if dxfout were used instead of saveas. Just curious
Pseudo code:
Code:(defun c:FOO () (vl-load-com) (vlax-for oLayout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (vl-catch-all-apply 'vla-delete (list oLayout))) (setvar 'clayer "0") (command "._change" "all" "" "properties" "layer" "0" "") (command "._-purge" "all" "" "no") (command "._dxfout" (vl-string-subst ".dxf" ".dwg" (strcat (getvar 'dwgprefix) (getvar 'dwgname))) 16) (princ))
"Potential has a shelf life." - Margaret Atwood

Registered forum members do not see this ad.
Cool. Still trying to learn this visiual lisp. Thanks
Bookmarks