Jump to content
Golfdave

Save As

Recommended Posts

Golfdave

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.

 

 

Share this post


Link to post
Share on other sites
dlanorh

Look at the Document "SaveAs" Method, which has a  "SaveAsType" Property

Share this post


Link to post
Share on other sites
dlanorh

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

 

Share this post


Link to post
Share on other sites
Golfdave

dlanorh, I am opening drawings that are already dxf files and modifying them. but i have to change to dxf to save them back. 

Share this post


Link to post
Share on other sites
Golfdave

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.

Share this post


Link to post
Share on other sites
dlanorh
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.

Share this post


Link to post
Share on other sites
tombu

Options => Open and Save tab, under Save as: select how you would like it saved.

Share this post


Link to post
Share on other sites
Cad64

You could use the DXFOUT command instead of SAVEAS.

Share this post


Link to post
Share on other sites
Golfdave

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.

Share this post


Link to post
Share on other sites
Golfdave

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.

 

Share this post


Link to post
Share on other sites
Golfdave

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. 

 

Share this post


Link to post
Share on other sites
David Bethel

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

Share this post


Link to post
Share on other sites
Golfdave

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.

Share this post


Link to post
Share on other sites
Golfdave

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)
)

Share this post


Link to post
Share on other sites
BIGAL

A quick freebie stops the dwgname.dxf.dxf

 


(setq dwgname (getvar 'dwgname))
(setq len (strlen dwgname))
(setq dwgname (substr dwgname 1 (- len 4)))

Share this post


Link to post
Share on other sites
ronjonp
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))

 

Share this post


Link to post
Share on other sites
Golfdave

I appreciate everyone's response, but the lisp routines I indicated do what I wanted. 

Thanks for everyone's help. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×