Stepping through a directory dwg files? or having to go back to previous dwgs? Try this simply utility, but compile as VLX. Please report any bugs you encounter to refine... (defun C:next (/ files name y) (setq files (vl-directory-files (getvar"dwgprefix") "*.dwg")) (if files (progn (setq files (acad_strlsort files) name (vl-position (getvar"dwgname") files) name (nth (1+ name) files) ) (if (or (= (getvar"dbmod") 1) (= (getvar"dbmod") 5) ) (progn (setq y (strcase (getstring "Save Drawing File? [N]o: "))) (if (= y "Y") (progn (command "qsave") (if name (command "open" (strcat (getvar "dwgprefix") name)) ) ) (progn (command "open" "n" (strcat (getvar "dwgprefix") name)) ) ) ) (progn (if (= (getvar"dbmod") 0) (progn (if name (command "open" (strcat (getvar "dwgprefix") name)) ) ) (progn (if name (command "open" "n" (strcat (getvar "dwgprefix") name)) ) ) ) ) ) ) ) (princ) ) (defun Crev (/ files name y) (setq files (vl-directory-files (getvar"dwgprefix") "*.dwg")) (if files (progn (setq files (acad_strlsort files) name (vl-position (getvar"dwgname") files) name (nth (- name 1) files) ) (if (or (= (getvar"dbmod") 1) (= (getvar"dbmod") 5) ) (progn (setq y (strcase (getstring "Save Drawing File? [N]o: "))) (if (= y "Y") (progn (command "qsave") (if name (command "open" (strcat (getvar "dwgprefix") name)) ) ) (progn (command "open" "n" (strcat (getvar "dwgprefix") name)) ) ) ) (progn (if (= (getvar"dbmod") 0) (progn (if name (command "open" (strcat (getvar "dwgprefix") name)) ) ) (progn (if name (command "open" "n" (strcat (getvar "dwgprefix") name)) ) ) ) ) ) ) ) (princ) ) -- AUTODESK Authorized Developer www.Cadentity.com MASi
AutoCAD 2000i - doesn't work for me. Had loaded as straight LSP then compiled to FAS & VLX, and still didn't work. Command: next Unknown command "N". Press F1 for help. Unknown command "U:\DRAWINGS\STEELCASE\PLOT\SC_A8-2.DWG". Press F1 for help. Tried simply: Command: (findfile "u:\\drawings\\steelcase\\plot\\sc_a8-2.dwg") "U:\\drawings\\steelcase\\plot\\sc_a8-2.dwg" Command: (command "open" "u:\\drawings\\steelcase\\plot\\sc_a8-2.dwg") Unknown command "U:\DRAWINGS\STEELCASE\PLOT\SC_A8-2.DWG". Press F1 for help. nil Command: (command "-open" "u:\\drawings\\steelcase\\plot\\sc_a8-2.dwg") Unknown command "-OPEN". Press F1 for help. Unknown command "U:\DRAWINGS\STEELCASE\PLOT\SC_A8-2.DWG". Press F1 for help. nil I seem to recall that in MDI you need to use: (command "._VBASTMT" (strcat "AcadApplication.Documents.Open \"" (strcase file) "\"")) ??? However what would be most useful is a routine that closes current and opens next. I believe only VBA can do that. Dan -- ;;; For reply, change numbers to decimal
The utility was written orig. for R14. But what you're asking I've already done for 2000+ and actually we posted this some time ago on the newsgroup. I can't remember when though....