I am writing a LISP to import DGNs into a current drawing but every time it goes to run, it stops because AutoCAD opens the .dgn in a new drawing! appearently DGNIMPORTMODE allows you to change that option but I do not have that command in 2011. any ideas?
Perhaps using a .scr file, to import the .dgn in a new dwg, save, close, insert the new .dwg at the current dwg...
HTH
Henrique
how can I use a script to dwgimport without it stopping the lisp or script?
when I use -dgnimport it opens the .dgn in a new window, therefor stops the script and lisp
@JustinTCox wrote:
when I use -dgnimport it opens the .dgn in a new window, therefor stops the script and lisp
It was just a thought, I don't have AutoCAD with me to test it ...
Henrique
@JustinTCox wrote:
when I use -dgnimport it opens the .dgn in a new window, therefor stops the script and lisp
With a script and SDI=1, should work ok...
EDIT: As a 'demo', change the dgn path and name to the correct one for testing.
(defun c:dgnin (/ CurrDwg Dgn Old_dia OpFil Sav ScrFil) (if (= (getvar 'SDI) 1) (progn (setq Dgn "C:\\Your\\Path\\TEST01.DGN" ScrFil "C:\\temp\\Temp.scr" CurrDwg (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME)) old_dia (getvar 'FILEDIA) OpFil (open ScrFil "W") ) (if (findfile "C:\\temp\\TempDwg.dwg") (setq sav (strcat "_.save" "\r" "C:\\temp\\TempDwg.dwg" "\r" "Y" "\r")) (setq sav (strcat "_.save" "\r" "C:\\temp\\TempDwg.dwg" "\r")) ) (setvar 'FILEDIA 0) (command "_.qsave") (write-line (strcat "_.qnew" "\r" "." "\r") OpFil) (write-line (strcat "-dgnimport" "\r" Dgn "\r" "\r" "\r" "\r") OpFil) (write-line sav OpFil) (write-line (strcat "_.open" "\r" CurrDwg "\r") OpFil) (write-line (strcat "_.insert" "\r" "C:\\temp\\TempDwg.dwg" "\r" "0,0,0" "\r" "1" "\r" "1" "\r" "0" "\r") OpFil) (write-line (strcat "FILEDIA" "\r" (itoa old_dia) "\r") OpFil) (close OpFil) (command "_.script" ScrFil) ) (prompt "\n Progrm only runs with SDI = 1 !!!") ) (princ) )
HTH
Henrique