Ron,
same thing, same result unfortunately. Now you write the script in the same function, but it stops after the first script. look s like the script is still running while the lisp already wants to rewrite the script (remember, you use the same name.) This is why i tried to make different scripts (wit ha counter) but the no script gets executed. it seems to me tha tyou can't run multiple script in a lisp, because the cmdactive stays at 4 (script) i tried everything i put in a command after the script, a while with cmdactive 4 (that loop never ends). so i don't l know. i attached the code change to make it draw a line (because yo udon't have the roho command) and the drawing, so you give it a test if you feel like. maybe it is something on my computer, setting or so.
Thanks Bernd
(defun c:rs()(if (setq ss (ssget "x" '((-4 . "<AND") (0 . "insert") (8 . "*577*") (-4 . "AND>"))))
(progn (setq file (strcat (getvar 'dwgprefix) "temp.scr"))
(setvar 'filedia 0)
(foreach x (ss->list ss)
(setq what (get_xdata_tl x "SubType.Descr")
shape (get_xdata_tl x "Shape.Descr")
sys (get_xdata_tl x "PipeDef.Descr")
)
(cond ((and (= what "Luchtkanaal") (= shape "Rond"))
(setq l (get_xdata_tl x "Length")
dia (get_xdata_tl x "SizeDescr")
)
(cond ((= sys "Lucht toevoer") (setq slw "T"))
((= sys "Lucht retour") (setq slw "R"))
)
(setq fo (open file "W"))
(write-line "_.line" fo)
;;;
;;; (write-line "M" fo)
;;;
;;; (write-line (vl-princ-to-string dia) fo)
(write-line (strcat (rtos (- 0 (/ l 2.)) 2 0) ",0,0") fo)
(write-line (strcat (rtos (/ l 2.) 2 0) ",0,0 ") fo)
(close fo)
(command "_.ucs" "ob" x "")
(command "_.script" file)
)
)
)
(setvar 'filedia 1)
(and (findfile file) (vl-file-delete file))
)
)
(princ)
)