Mr Willy
I could find what i want. but it is not working. The error is - Select objects: ; error: bad argument type: lselsetp nil. please rectify this code for me. Iam using Autocad2008. It will very usefull to me. Thank you.
Select objects: ; error: bad argument type: lselsetp nil.
That means incorrect Data type. So.. agaim, are you using MTEXT?
@Anonymous wrote:
Can someone steer me ... to a lisp routine that will add together the values of text entities?....
Another approach:
http://cadtips.cadalyst.com/list/sum-values-text-strings
I don't see anything in the description that mentions Mtext, and I haven't downloaded it, so it may also work only with Text entities.
@Kent1Cooper wrote:I don't see anything in the description that mentions Mtext, and I haven't downloaded it, so it may also work only with Text entities.
Exactly my point. as the error mesage indicate as such
@pbejse wrote:That means incorrect Data type. So.. agaim, are you using MTEXT?This is me short of tellimg the OP his trying to use the porogram with Mtext entities, but apparently the OP directing the question to the orignal author of the code.
Oh well,..
Nice tip BTW
Tim,
Works great, but where in the lsp could I change the rounding precision of the final number. The numbers I am selecting are all rounded to the second decimal place (which I want), BUT the sum number the lsp is givinf me is rounded to the fisrt decimal place (which I would like to change to the second). Thanks
@rsteel wrote:.... where in the lsp could I change the rounding precision of the final number. ... the sum number the lsp is givinf me is rounded to the fisrt decimal place (which I would like to change to the second). ....
[In case Tim's not still checking in after 8-1/2 years....]
Change the last number in the (rtos) functions such as (rtos nu5 2 1) from a 1 to a 2 -- that's the number of decimal places [see (rtos) in the AutoLISP Reference].
Hello
An other solution which can read Text & MText entities ...
This routine (TOTTXT) comes froma French forum but I don't remender the Author : SORRY !
Bye, Patrice
;; Routine TOTTXT.LSP ;; Fonctionne en principe sur les TEXT & MTEXT de type numerique ;; Version 1.1 avec Creation d un texte du Total (defun c:tottxt (/ doc sel tot pt) (vl-load-com) (setq tot 0 doc (vla-get-activedocument (vlax-get-acad-object)) ) (princ "\nSélectionnez les textes") (if (ssget (list (cons 0 "TEXT,MTEXT"))) (progn (vlax-map-collection (setq sel (vla-get-activeselectionset doc)) '(lambda (x) (setq tot (+ (atof (vla-get-textstring x)) tot)) ) ) (vla-delete sel) (if (setq pt (getpoint "\nPositionnez le résultat: ")) (vla-addText (vla-get-ModelSpace doc) (rtos tot) (vlax-3d-point pt) (getvar "TEXTSIZE") ) ) ) ) )
Patrice BRAUD