I have a Autolisp program as defined below it works very well. Essentially the program open drawings in a selected folder and opens each drawing in turn updating the attributes in the Title Block. And all that works well. The problem I have is when the drawing loads, I get a white screen I can't see my title block in paper space as I should. As the drawings load into AutoCAD 2018 MEP I intermittently see a title block in paper space and then when the next drawing loads again I see a white screen in paper space.
Any Ideas on this? Any help much appreciated. Perhaps some veteran AutoCAD 2018 MEP users might have some ideas.
(defun c:A1TB(/ filepath dir n tfiles)
;;Prompt the user to select a folder containing drawings
(if (setq filepath (getfiled "Select a Drawing File..." "" "dwg" 16))
(progn
;;Grab the directory only from the selected path. Remove the selected filename
(setq dir (VL-FILENAME-DIRECTORY filepath))
;;Create a list of all the drawings from the above selected folder
(setq tfiles (vl-directory-files dir "*.dwg" 1))
;;Retrieve the current value of cmdecho
(setq oldcmd (getvar "cmdecho"))
;;Turn off the command echo
(setvar "cmdecho" 0)
;;Retrieve the current value of lispinit
(setq oldinit (getvar "lispinit"))
;;Retrieve the current value of SDI Single Document Interface
(setq oldSDI (getvar "SDI"))
;;Set SDI to 0 Single Document Interface
(setvar "SDI" 0)
;;lispinit 0 = AutoLISP functions and variables are preserved from drawing to drawing
(setvar "LISPINIT" 0)
(setq n 0) ;;Initialise our n counter variable to 0 this variable is used to step through our drawing list
;;Iterate through all the drawing in the selected folder. Open each drawing in turn one by one, and update the attributes
(while (< n (length tfiles))
;;Open the nth drawing in the list for processing
(command "_.fileopen" (strcat dir "\\" (nth n tfiles)))
;;Switch to Paperspace
(command "_.tilemode" 0)
;;Zoom extents on the drawing
(command "_.zoom" "e")
(tb) ;;Update our attributes in the drawing title block. Moving across each tab and updating each title block as necessary
;;Save our drawing after updating the attributes
(command "_.qsave")
;;Increment our n variable, prepare to load the next drawing in from our drawing list tfiles
(setq n (+ 1 n))
);;End While
;;Reset command echo
(setvar "cmdecho" oldcmd)
;;Reset LISPINIT
(setvar "lispinit" oldinit)
;;Reset SDI
(setvar "SDI" oldSDI)
;;Notify the user how many drawings were processed
(alert (strcat "A1TB Command Complete " (itoa n) " drawings opened"))
(princ)
)
(progn
;;If the dialog for selecting the drawings was cancelled, Notify the user.
(alert "\nA1TB command was cancelled...")
(princ)
)
)
)
I was going to try GRAPHICSCONFIG and turn it off or turn ANNOALLVISIBLE on and see if that helps. I wonder has it something to do with SDI on or off and LISPINIT