kArThIcK hAcKeR Posted July 8, 2013 Posted July 8, 2013 Hello, everyone. I get 50 DWG Drawings per day and i had to convert it to dxf. 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. Now pressing "s" 50 times is the irritating part. Can somebody help me to mass save the document without having to open the document and pressing "s" 50 times!!! Quote
Lee Mac Posted July 8, 2013 Posted July 8, 2013 Add the following code to your ACADDOC.lsp:(defun todxf ( ) (command "_.dxfout" "" "16" "_.regen" "_.close" "_Y")) Open a new drawing. Load and Run my ScriptWriter program. 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. Quote
dbroada Posted July 8, 2013 Posted July 8, 2013 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. Quote
kArThIcK hAcKeR Posted July 8, 2013 Author Posted July 8, 2013 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!!! thanks Lee BTW how do i mark this post as solved? Quote
Lee Mac Posted July 8, 2013 Posted July 8, 2013 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. Quote
kArThIcK hAcKeR Posted July 8, 2013 Author Posted July 8, 2013 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, (BTW, i am the same karthik who contacted you for Copy to drawings and bfind.lsp) Quote
Lee Mac Posted July 8, 2013 Posted July 8, 2013 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. Quote
dbroada Posted July 8, 2013 Posted July 8, 2013 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. Quote
Bill Tillman Posted July 8, 2013 Posted July 8, 2013 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. Quote
kArThIcK hAcKeR Posted May 3, 2014 Author Posted May 3, 2014 U Can Use This Software, http://www.cadtutor.net/forum/showthread.php?86184-AutoCAD-Mass-Convert-DWG-To-DXF-%28Batch-Convert-DWG-To-DXF%29-%28Mas-DWG-Convert%29&p=592237#post592237 Quote
akshayghodake Posted February 15, 2022 Posted February 15, 2022 (edited) 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 February 15, 2022 by akshayghodake Quote
BIGAL Posted February 16, 2022 Posted February 16, 2022 Use Appload and add to Startup suite, you will have to save the short defun lisp 1st. Quote
SLW210 Posted February 16, 2022 Posted February 16, 2022 You usually have to create the acaddoc.lsp. See if ACADDOC.lsp Creator | Lee Mac Programming (lee-mac.com) helps. 1 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.