Golfdave Posted September 14, 2018 Posted September 14, 2018 Is it possible to create a lisp to change the autocad "Save as" type? I have to constantly change my file save as type from 2013.dwg to 2007.dxf and back again.(I create part drawings that have to be saved as dxf for machining purposes.) would be nice to have a lisp to do this. Currently I either change the type when i save the file in the drop down menu or if I have a lot to do I go to options and change the "save as" type there and then back again. would like to just run a lisp that would let me switch back and forth. Quote
dlanorh Posted September 14, 2018 Posted September 14, 2018 Look at the Document "SaveAs" Method, which has a "SaveAsType" Property Quote
dlanorh Posted September 14, 2018 Posted September 14, 2018 Have dug out a short lisp and altered to suit. This will save the current drawing (whole drawing) as a dxf file in the current drawings directory. It doesn't alter the preferences so a normal save will still be in the set format. (defun c:asdxf ( / c_doc) (setq c_doc (vla-get-activedocument (vlax-get-acad-object))) (vla-saveas c_doc (vlax-get-property c_doc 'fullname) ac2007_dxf) (princ "Drawing saved in 2007_dxf Format") );end_defun 1 Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 dlanorh, I am opening drawings that are already dxf files and modifying them. but i have to change to dxf to save them back. Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 dlnorh, the lisp you show saves the entire filename including the extension I.E. test.dwg saves as test.dwg.dxf but I do appreciate you responding. thank you. Quote
dlanorh Posted September 14, 2018 Posted September 14, 2018 17 minutes ago, Golfdave said: dlanorh, I am opening drawings that are already dxf files and modifying them. but i have to change to dxf to save them back. So you just need to toggle the saveas in the preferences, sorry for my misunderstanding, i'll see what i can do. Quote
tombu Posted September 14, 2018 Posted September 14, 2018 Options => Open and Save tab, under Save as: select how you would like it saved. Quote
Cad64 Posted September 14, 2018 Posted September 14, 2018 You could use the DXFOUT command instead of SAVEAS. Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 That is what I currently do, or select from the drop down in the "save as" window, ctrl s pops up saves as window and i change the "Files of type" to dxf. I was just looking to eliminate a step. wanted to create an icon or keyboard alias to switch the saves as type from dwg to dxf and back. always looking for ways to make things faster. Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 Cad64 , If the save as type is set to "DXF" then I can ctrl s to save the file with dxfout i still have to select 2007 dxf to save. Quote
Dahzee Posted September 14, 2018 Posted September 14, 2018 @Golfdave, This post might have what you are looking for. You can adjust the lisp to your required version and folder. Create a button or keyboard shortcut. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dxfout-select-objects/td-p/2532631 Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 I can do it with a macro. +saveas input save format dxf dxf version 2007 this opens the save as drawing window in autocad 2007 dxf. Just not sure this is the best method. Quote
David Bethel Posted September 14, 2018 Posted September 14, 2018 With dxfout ( which I use a LOT ), you have to be careful to only offer options that are available with release you are working on. These have changed many time over the years. -David Quote
Golfdave Posted September 14, 2018 Author Posted September 14, 2018 I use dxfout all the time when saving dwg files as dxf. but in this case I am editing and existing dxf and just trying to save the change. so I don't need to create a DXF just save it in the same format. Quote
Golfdave Posted September 18, 2018 Author Posted September 18, 2018 guess I was making this more difficult then it needed to be. very simple. This changes it to 2007 DXF (defun c:dxf () (setenv "DefaultFormatForSave" "37") (princ) ) This changes it to 2013 dwg (defun c:dwg () (setenv "DefaultFormatForSave" "60") (princ) ) Quote
BIGAL Posted September 19, 2018 Posted September 19, 2018 A quick freebie stops the dwgname.dxf.dxf (setq dwgname (getvar 'dwgname)) (setq len (strlen dwgname)) (setq dwgname (substr dwgname 1 (- len 4))) 1 Quote
ronjonp Posted September 19, 2018 Posted September 19, 2018 10 hours ago, BIGAL said: (setq dwgname (getvar 'dwgname)) (setq len (strlen dwgname)) (setq dwgname (substr dwgname 1 (- len 4))) This does the same: (vl-filename-base (getvar 'dwgname)) 1 Quote
Golfdave Posted September 19, 2018 Author Posted September 19, 2018 I appreciate everyone's response, but the lisp routines I indicated do what I wanted. Thanks for everyone's help. 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.