Add Text values

Discussion in 'AutoCAD' started by bmossman, Oct 15, 2004.

  1. bmossman

    bmossman Guest

    Does anyone have a routine that will prompt user to pick text entities and accumulate their value?
     
    bmossman, Oct 15, 2004
    #1
  2. bmossman

    Jim Claypool Guest

    (defun c:addtext ( / ss cnt txtval ename)
    (setq
    ss (ssget '((0 . "TEXT")))
    cnt 0
    txtval 0
    )
    (if ss
    (repeat (sslength ss)
    (setq
    ename (ssname ss cnt)
    txtval (+ txtval (atof (cdr (assoc 1 (entget ename)))))
    cnt (1+ cnt)
    )
    );end repeat
    )
    (princ (strcat "\nTotal value = " (rtos txtval)))
    (princ)
    )
     
    Jim Claypool, Oct 15, 2004
    #2
  3. I assume you're talking about text strings representing numerical values --
    I don't have one, but look into the (atof) function, which would be the main
    ingredient. (But it wouldn't work with fractions.)
     
    Kent Cooper, AIA, Oct 15, 2004
    #3
  4. bmossman

    bmossman Guest

    Thanks Jim thats what i was looking for!!!
     
    bmossman, Oct 16, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.