SLW210 Posted January 31 Posted January 31 I thought I would post the Drawing to DXF batch converter, as well as the others I have worked on. All thanks go to the originator and the others that have made modifications and updates, I did very little. I think some of these need cleaning up, but as far as I can tell, they get the job done. I had need to convert folders of .dwg's to .dxf's for use on a waterjet, etc. that best use version 2000 so it converts to DXF2000. Easy enough to modify for current version or any other if needed. ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Modified to Batch Convert AutoCAD® DWG *.dwg into DXF *.dxf>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; | ;;; Original versions I got from here | ;;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-convert-dgn-to-dwg/td-p/3237978 | ;;; | ;;;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ;;; ;;;* DGNIMPORT.LSP - Converts a list of Microstation *.dgn drawings into AutoCAD *.dwg drawings ;;; Start command by typing DGNI ;;; ;;; Make the necessary adjustments to the following variables: ;;; --------------------------------------------------------- ;;; tx1 = path and name of a file that holds a list with names for all the *.dgn's to be imported, ;;; names of *.dgn drawings may be written without extension, as well as with extension, ;;; in plain text format, no return after the last line. ;;; tx2 = the path for the input folder, containing the actual *.dgn files to import. ;;; tx3 = the path for the output folder, where the drawings converted into *.dwg will be saved, ;;; (routine assumes that the *.dwg files do not exist yet) ;;; tx4 = name of the drawing model to import ;;; ;;; ;;; The routine reads drawing names from the file given in tx1 line-for-line. ;;; In each loop it performs a DGNIMPORT from the folder given as tx2 into the existing AutoCAD drawing, ;;; does a Zoom Extends, saves the converted drawing result as *.dwg in the folder given as tx3, ;;; and finally restores the drawing to its original state, ready to receive the next DGNIMPORT loop. ;;; ;;; The DELAY command for 1000 milliseconds (1 second) is needed to provide sufficient separation ;;; between the DGNIMPORT and SAVEAS processes (otherwise it starts to mix up drawings). ;;; ;;; The DGNIMPORT command trips when the name of the *.dgn to be imported contains a comma, ;;; I advise to rename drawings having this issue. ;;; ;;; Written by M. Moolhuysen. Modified by C. Matthews ;;; ;;; Modified by Cage Here https://www.cadtutor.net/forum/topic/78123-batch-convert-acis-sat-to-dwg/#comment-624627 ;;; ;;; This software may not be sold as commercial product or included as part of a commercial product. ;;; ;;; ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ ;;; * ;;; Converts a folder of AutoCAD® DWG *.dwg drawings into DXF *.dxf drawings (Version 2000) * ;;; * ;;; Start command by typing DWG2DXF * ;;; * ;;; Modified by SLW210 A.K.A. Steve Wilson from DGNIMPORT to DWG2DXF 01/31/2024 * ;;; * ;;;************************************************************************************************************************ ;;;************************************************************************************************************************ (defun C:DWG2DXF (/ fil tx1 tx2 tx3 tx4 tx5) (princ "Please select input folder. \n") (setq tx1 (vl-directory-files (setq tx2 (acet-ui-pickdir)) "*.dwg")) ; Select the folder containing *.dwg files to be imported. (princ "Please select output folder. \n") (setq tx3 (acet-ui-pickdir) ; Select folder for the *.dxf files to be exported into. tx4 "Default" ) (setvar "FILEDIA" 0) (foreach tx5 tx1 (if (wcmatch tx5 "*`.???") (setq tx5 (substr tx5 1 (- (strlen tx5) 4))) ) (command "_UNDO" "_MARK" "OPEN" "" (strcat tx2 "\\" tx5) tx4 "" "" "_ZOOM" "_E" "._DELAY" 500 "_SAVEAS" "D" "V" "2000" "16" (strcat tx3 "\\" tx5 ".dxf") "_N" ) (command "_ERASE" "ALL" "") ;erases everything on the page after the save (command "_.purge" "_all" "" "_no") ;purges everything so you don't carry it over to the next drawing (command "_.purge" "_regapp" "" "_no") (command "_QNEW") ;opens a new drawing (setvar "FILEDIA" 0) ) (princ) ) DWG2DXF.lsp DXF2DWG.lsp DGN to DWG v2.lsp SAT2DWGv2.lsp 2 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.