Search the Community
Showing results for tags 'loop instruction'.
-
Hello, guys! I'm new here. So, please, be gentle. I had a problem with a routine. I have to open all the drawings in the same folder, compare a specific area of the drawing with a reference and change that area, if necessary. But I have a lot of references to compare, so I need to do that many times. I've already got a batch to open all the drawings in the same folder. So I just modified it to compare the area with the reference and it worked greatly. The only problem is: When i put that batch inside a loop instruction (to change the reference that will be compared), the batch didn't worked. The following error appears: ; error: bad argument type: streamp nil Here goes the code. Could someone help me? (defun c:testloop (/) (setq c 1) (while ( (c:opendrawings) (setq c (1+ c)) ); end while ); end function to test the loop (defun c:opendrawings (/ dwglist dwgname dwgpre file openfile uhoh len) (vl-load-com) (if (and (setq dwgpre (getvar 'dwgprefix)) (setq dwglist (vl-sort (vl-remove (strcat dwgpre (getvar 'dwgname)) (mapcar '(lambda (dwgname) (strcat dwgpre dwgname)) (vl-directory-files dwgpre "*.dwg") ) ) ' ) ) (setq uhoh "Readonly drawings will not be processed!" ) (setq len (strlen uhoh)) ) (progn (setq openfile (open (setq file (strcat dwgpre "myscript.scr")) "w")) (progn (foreach f dwglist (if (and (not (Is_ReadOnly f)) (/= (checkAttFile f) 1) ) (progn (write-line (strcat "_.open \"" f "\"") openfile) (write-line "_.audit _y" openfile) ; (write-line "_.qsave _.close" openfile) ) (setq uhoh (strcat uhoh "\n" f)) ) ) (close openfile) (command "_.script" file) (if (= (strlen uhoh) len) (princ "All drawings successfully processed...") (alert uhoh) ) ) ) ) (princ) ); end function to open all the drawings
- 4 replies
-
- open all drawings
- loop instruction
-
(and 2 more)
Tagged with: