Search the Community
Showing results for tags 'subroutine'.
-
I wanted to create a new thread since it's a different problem even though it is from a previous thread. Since I never know how many instances of a font that needs changing (SLDTEXTSTYLE) I wanted to create a counter. http://www.cadtutor.net/forum/showthread.php?91375http:// Digging around I found a way to create my counter number from this thread: http://www.cadtutor.net/forum/archive/index.php/t-76290.html How do I make the CNT a subroutine and call it from C:SWT (defun c:cnt () (setq la (cdr (assoc 2 (tblnext "STYLE" T)))) (setq lal (list la)) (while (/= (setq la (cdr (assoc 2 (tblnext "STYLE")))) nil) (setq lal (append lal (list la)) ) ) (setq LEN (length lal)) ) (defun c:swt (/ i s) (Princ "\nFinds all SW Text Styles, replaces with ROMANS Font:") (if (not (tblsearch "STYLE" "ROMANS")) (progn (command "_.STYLE" "ROMANS" "ROMANS") (while (> (getvar "CMDACTIVE") 0) (command "")))) (setq i 0) (repeat 9 ; All my LEN from the subroutine here? (setq s (strcat "SLDTEXTSTYLE" (itoa i))) (if (tblsearch "STYLE" s) (progn (command "_.STYLE" s "ROMANS") (while (> (getvar "CMDACTIVE") 0) (command "")))) (setq i (1+ i))) (princ)) And of course if there is a "better way" I'm always open to that too!! Thanks Much!