Jump to content

Mass convert dwg to dxf


kArThIcK hAcKeR

Recommended Posts

Hello, everyone.

 

I get 50 DWG Drawings per day and i had to convert it to dxf.:popcorn:

 

So i made a little lisp to automate the conversion process.

 

LISP:

(defun c:s()
(command "dxfout")
(command "")
(command "16")
(command "regen")
(command "_close" "y")
)

Now that i have this lisp i'll drag all the 50 dwg's to autocad for opening them and then i'll have to press "s" 50 times. 8)

 

Now pressing "s" 50 times is the irritating part.:itsover:

 

Can somebody help me to mass save the document without having to open the document and pressing "s" 50 times!!!:huh:

Link to comment
Share on other sites

  • Add the following code to your ACADDOC.lsp:
    (defun todxf ( ) (command "_.dxfout" "" "16" "_.regen" "_.close" "_Y"))


 

  • Open a new drawing.

 

 

  • Enter the following as the 'Script Line':
    _.open *file* (todxf)


 

  • Choose a directory of drawings to process (and whether or not to include subdirectories).

 

  • Run the program.

Link to comment
Share on other sites

I was about to recommend you look on Lee Mac's site for a script writer program that will allow you to do this so of task quite simply. However, I did a refresh before posting and see he has beaten me to it.

Link to comment
Share on other sites

It Opens Each and every document,

during the process i am unable to minimize the autocad, and the autocad pops up above all the other softwares; Not what i expected, but it works!!!

:D

thanks Lee

BTW

how do i mark this post as solved?

Link to comment
Share on other sites

It Opens Each and every document, during the process i am unable to minimize the autocad, and the autocad pops up above all the other softwares; Not what i expected, but it works!!!

 

I'm guessing you haven't run a script before ;)

 

how do i mark this post as solved?

 

This forum unfortunately doesn't offer that option.

Link to comment
Share on other sites

Yes, i have never wrote any scripts b4.

i thought that lisp is powerfull than script thats why.

:)

Any ways thanks for the immediate reply lee,

 

:roll:(BTW, i am the same karthik who contacted you for Copy to drawings and bfind.lsp)

Link to comment
Share on other sites

i thought that lisp is powerfull than script thats why.

 

LISP is indeed far more powerful than an AutoCAD Script (which is simply a list of commands to be successively executed at the AutoCAD command-line), however, since both the AutoLISP & Visual LISP APIs run within the document namespace, they can only operate on the active drawing (with the exception of an ObjectDBX interface); whereas a Script provides a means to consecutively open and close a set of drawings, allowing batch processing.

 

I tend to use AutoCAD Scripts purely to open, save & close drawings for batch processing - after the drawing has been opened, I will perform all operations using a more powerful and robust AutoLISP program, before the Script then saves & closes the drawing. This way, one can exploit the batch processing ability of an AutoCAD Script, whilst making use of the superior power & error trapping afforded by AutoLISP.

Link to comment
Share on other sites

I tend to use AutoCAD Scripts purely to open, save & close drawings for batch processing - after the drawing has been opened, I will perform all operations using a more powerful and robust AutoLISP program, before the Script then saves & closes the drawing. This way, one can exploit the batch processing ability of an AutoCAD Script, whilst making use of the superior power & error trapping afforded by AutoLISP.
I use scripts far more than Lee does, mostly as I am far less able in LISP than Lee but the BIG problem with scripts, as Lee points out, is their inability to trap errors. If an error occurs within a script AutoCAD will continue to accept input from the script as though it were being typed at the keyboard. This usually just results in the script never supplying a correct answer to any of the promps and the scripts will get to the end never having performed any actions. However occassionaly by coincidence a valid response is received with disasterous consequences. However, within their limitations, scripts are a powerful and underutilsed tool.
Link to comment
Share on other sites

dbroada makes a very good point. I did a batch operation not too long ago with LISP and it worked very well. I would recommend that you make a scratch copy of the folder(files) you want to work with and work on that copy with your script or LISP program. That way if something goes wrong you've got the originals intact. Remember, to err is human, but to really foul things up it takes a computer.

Link to comment
Share on other sites

  • 9 months later...
  • 7 years later...
On 7/8/2013 at 3:54 PM, Lee Mac said:

 

  • Add the following code to your ACADDOC.lsp:
    (defun todxf ( ) (command "_.dxfout" "" "16" "_.regen" "_.close" "_Y"))
    Where can I find ACADDOC.lsp?

     

 

 

 

Edited by akshayghodake
Link to comment
Share on other sites

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