Lee Mac Posted March 10, 2009 Posted March 10, 2009 sorry, forgot to change layers (having a maire): (defun c:txtupd (/ ss eLst tpt tval npt lst) (vl-load-com) (if (setq ss (ssget "X" (list (cons 0 "*TEXT") (cons 8 "[color=#2f4f4f]LEVEL,LEVEL-KYL,LEVEL-S[/color]") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (setq eLst (mapcar 'entget (mapcar 'cadr (ssnamex ss)))) (foreach ent eLst (setq tpt (cdr (assoc 10 ent))) (if (eq (nth 1 (vl-string->list (cdr (assoc 1 ent)))) 32) (setq tval (rtos (+ (distof (substr (cdr (assoc 1 ent)) 3)) 0.28))) (setq tval (rtos (+ (distof (substr (cdr (assoc 1 ent)) 2)) 0.28)))) (if (> (last tpt) 0) (setq npt (subst (+ (last tpt) 0.28) (last tpt) tpt)) (setq npt tpt)) (mapcar '(lambda (new old) (setq lst (subst new old ent))) (list (cons 10 npt) (cons 1 (strcat "Z" tval))) (list (assoc 10 ent) (assoc 1 ent))) (entmod lst))) (princ "\n<!> No Text Found <!>")) (princ)) Quote
automicro Posted March 11, 2009 Author Posted March 11, 2009 Thansk Lee Mac 1: You forgot to increase the z coordinate of the texts, where text z-coordinate value is greater than 0 2: The texts will be fine, but if possible, rounding to 2 decimal places /automicro Quote
Lee Mac Posted March 11, 2009 Posted March 11, 2009 Thansk Lee Mac 1: You forgot to increase the z coordinate of the texts, where text z-coordinate value is greater than 0 This has been sorted now. 2: The texts will be fine, but if possible, rounding to 2 decimal places The text is set to round to whatever value your LUPREC variable is set at. But i have changed it anyway. (defun c:txtupd (/ ss eLst tpt tval npt lst) (vl-load-com) (if (setq ss (ssget "X" (list (cons 0 "*TEXT") (cons 8 "LEVEL,LEVEL-KYL,LEVEL-S") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (setq eLst (mapcar 'entget (mapcar 'cadr (ssnamex ss)))) (foreach ent eLst (setq tpt (cdr (assoc 10 ent))) (if (eq (nth 1 (vl-string->list (cdr (assoc 1 ent)))) 32) (setq tval (rtos (+ (distof (substr (cdr (assoc 1 ent)) 3)) 0.28) 2 2)) (setq tval (rtos (+ (distof (substr (cdr (assoc 1 ent)) 2)) 0.28) 2 2))) (if (> (last tpt) 0) (setq npt (subst (+ (last tpt) 0.28) (last tpt) tpt)) (setq npt tpt)) (entmod (subst (cons 10 npt) (assoc 10 ent) (subst (cons 1 (strcat "Z" tval)) (assoc 1 ent) ent))))) (princ "\n<!> No Text Found <!>")) (princ)) Quote
automicro Posted March 11, 2009 Author Posted March 11, 2009 Thanks Lee Mac is going to test tomorrow and will return with feedback /automicro Quote
Lee Mac Posted March 11, 2009 Posted March 11, 2009 Thanks Lee Mac is going to test tomorrow and will return with feedback /automicro Can't believe how long this thread has been going for such a simple routine... Quote
automicro Posted March 16, 2009 Author Posted March 16, 2009 Can't believe how long this thread has been going for such a simple routine... Maybe because I have not explained clearly enough:oops: Now it seems working as I want. This will save me a lot of work. Thanks Lee Mac:) Quote
automicro Posted April 2, 2009 Author Posted April 2, 2009 When I ran your program, so went the good of all files except the one your program responded like this: "; error: bad argument type: numberp: nil" And the program stop there. Whats is the problem? /automicro EDIT: Found the problem, there was "," in the text and not "." as decimal separator. Quote
Lee Mac Posted April 2, 2009 Posted April 2, 2009 When I ran your program, so went the good of all files except the one your program responded like this: "; error: bad argument type: numberp: nil" And the program stop there. Whats is the problem? /automicro EDIT: Found the problem, there was "," in the text and not "." as decimal separator. Ahh, yes, that would mess with the distof when converting the string to a real. 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.