(defun C:DGN2DWG_batch_rev (/ fil tx1 tx2 tx3 tx4 tx5)
(setq tx1 "R:\Scanned_Files\Scanned_Files_TUL\DWG's\RW 18R-36L Safety Area 2013 Asbids\RW 18R-36L Safety Area 2013 Asbids\As-Bid CAD files\DGN-LIST.txt"
tx2 "R:\Scanned_Files\Scanned_Files_TUL\DWG's\RW 18R-36L Safety Area 2013 Asbids\RW 18R-36L Safety Area 2013 Asbids\As-Bid CAD files\"
tx3 "R:\Scanned_Files\Scanned_Files_TUL\DWG's\RW 18R-36L Safety Area 2013 Asbids\RW 18R-36L Safety Area 2013 Asbids\As-Bid CAD files\DWG\"
tx4 "Default"
)
(setvar "DGNIMPORTMODE" 1)
(setq fil (open tx1 "r")
tx5 (read-line fil)) ; repeats program until all lines from the list with *.dgn drawing names are read.
(while tx5 ; strips an extension with length of 3 characters from the drawing name, if present.
(if (wcmatch tx5 "*`.???")
(setq tx5 (substr tx5 1 (- (strlen tx5) 4)))
)
(command "_UNDO" "_MARK"
"_DGNIMPORT" (strcat tx2 tx5) tx4 "" ""
"_ZOOM" "_E"
"_DELAY" 500
"_SAVEAS" "2000(LT2000)" (strcat tx3 tx5)
)
(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
(setq tx5 (read-line fil))
)
(close fil)
(command "_QUIT" "_Y")
(princ)
)
Set correct paths, and don't use ' in directory name (dwg's). Try to run and report result.
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.