ninjaroo5075 Posted October 1, 2015 Posted October 1, 2015 can anyone help i am trying to find the command to cancel. I have a lisp that just keeps running over and over until i press esc. Quote
Lee Mac Posted October 1, 2015 Posted October 1, 2015 Is the program stuck in a loop or does it continuously prompt for user input? Quote
ninjaroo5075 Posted October 1, 2015 Author Posted October 1, 2015 This is the code i have. (defun c:wa () (command "area" "o" pause) then (setq STRTAB (getpoint "\nLocate a Start Point For Text ") z 27 SCF (getvar "USERR4") ) (command "osnap" "NONE") (setq es (car strtab) ns (cdr strtab) ns (- (car ns) (* SCF 3.5)) ) (while z (setq S1 (list es ns) S2 (list (+ (* SCF 0. es) ns) ) (command "LAYER" "m" "AREA" "c" "yellow" "" "") (setq ONE (command "text" "s" "TTS" "j" "r" S1 90.0 (strcat (rtos (getvar "area") '2 '0)))) (command "layer" "m" "AREA" "c" "yellow" "" "") (setq TWO (command "text" "s" "AREA" "j" "l" S2 90.0 "m%%2012")) ) ) Quote
rlx Posted October 1, 2015 Posted October 1, 2015 This is the code i have. (defun c:wa () (command "area" "o" pause) then (setq STRTAB (getpoint "\nLocate a Start Point For Text ") z 27 SCF (getvar "USERR4") ) (command "osnap" "NONE") (setq es (car strtab) ns (cdr strtab) ns (- (car ns) (* SCF 3.5)) ) (while z (setq S1 (list es ns) S2 (list (+ (* SCF 0. es) ns) ) (command "LAYER" "m" "AREA" "c" "yellow" "" "") (setq ONE (command "text" "s" "TTS" "j" "r" S1 90.0 (strcat (rtos (getvar "area") '2 '0)))) (command "layer" "m" "AREA" "c" "yellow" "" "") (setq TWO (command "text" "s" "AREA" "j" "l" S2 90.0 "m%%2012")) ) ) Perhaps because '(while z' will always be true? You no nowhere make it nil gr. Rlx Quote
ninjaroo5075 Posted October 1, 2015 Author Posted October 1, 2015 i took while z out and it works thanks (defun c:wa () (command "area" "o" pause) then (setq STRTAB (getpoint "\nLocate a Start Point For Text ") z 27 SCF (getvar "USERR4") ) (command "osnap" "NONE") (setq es (car strtab) ns (cdr strtab) ns (- (car ns) (* SCF 3.5)) ) (setq S1 (list es ns) S2 (list (+ (* SCF 0. es) ns) ) (command "LAYER" "m" "AREA" "c" "yellow" "" "") (setq ONE (command "text" "s" "TTS" "j" "r" S1 90.0 (strcat (rtos (getvar "area") '2 '0)))) (command "layer" "m" "AREA" "c" "yellow" "" "") (setq TWO (command "text" "s" "AREA" "j" "l" S2 90.0 "m%%2012")) ) Quote
Lt Dan's legs Posted October 5, 2015 Posted October 5, 2015 (edited) This is incomplete but, it should help you move away from the command function (defun RB:HowItsMade ( obj / RB:pad ) (defun RB:pad ( int ) ( (lambda ( str ) (repeat int (setq str (strcat " " str)) ) str ) "" ) ) (and (eq 'VLA-OBJECT (type obj)) (setq obj (handent (vla-get-handle obj))) ) ( (lambda ( n / flag ) (foreach x (append (list "(entmakex" "(list") (entget obj '("Acad")) ) (if (or (eq 'STR (type x)) (not (or (eq 5 (car x)) (eq 'ENAME (type (cdr x))) ) ) ) (princ (strcat "\n" (rb:pad n) (if (listp x) (strcat "(cons " (vl-princ-to-string (car x)) " " (cond ( (listp (cdr x)) (strcat "'" (vl-princ-to-string (cdr x))) ) ( (eq 'STR (type (cdr x))) (strcat "\"" (vl-princ-to-string (cdr x)) "\"") ) ( (vl-princ-to-string (cdr x)) ) ) ")" ) x ) ) ) ) (if (not (vl-string-search ")" (vl-princ-to-string x))) (setq n (+ 2 n)) ) ) (repeat (/ n 2) (princ (strcat "\n" (rb:pad (setq n (- n 2))) ")")) )(princ) ) 0 ) ) example: (rb:howitsmade (car (entsel "\nSelect object to see how it's made: "))) Edited October 7, 2015 by Lt Dan's legs Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.