Jump to content

Recommended Posts

Posted

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))

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    15

  • automicro

    12

  • eldon

    2

Posted

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

 

Posted

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))

Posted

Thanks Lee Mac is going to test tomorrow and

will return with feedback

 

/automicro

Posted

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... :P

Posted
Can't believe how long this thread has been going for such a simple routine... :P

 

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:)

  • 3 weeks later...
Posted

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.

 

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...