Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: need lisp that will sum selected text values
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: need lisp that will sum selected text values
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: need lisp that will sum selected text values
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Rusty Steel
Cobb Engineering Company
Re: need lisp that will sum selected text values
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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].
Re: need lisp that will sum selected text values
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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")
)
)
)
)
)


