Jump to content

Recommended Posts

Posted

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.

 

 

Posted

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

Posted

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

 

  • Like 1
Posted

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

Posted

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.

Posted
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.

Posted

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

Posted

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.

Posted

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.

 

Posted

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. 

 

Posted

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

Posted

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.

Posted

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

Posted

A quick freebie stops the dwgname.dxf.dxf

 


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

  • Like 1
Posted
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))

 

  • Like 1
Posted

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

Thanks for everyone's help. 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...