Butch Posted November 5, 2009 Posted November 5, 2009 Hello! Is this possible? Usualy I have in my drawings bunch of text objects that only contain number values like 150, 12, 45.45 Is it possible to select them all at once and sum all the values? Quote
fixo Posted November 5, 2009 Posted November 5, 2009 Hello!Is this possible? Usualy I have in my drawings bunch of text objects that only contain number values like 150, 12, 45.45 Is it possible to select them all at once and sum all the values? Give this a shot (defun C:SUM (/ sum ss) (vl-load-com) (prompt "\n\t\t***\tSelect text objects\t***") (if (setq ss (ssget "_:L" '((0 . "TEXT")))) (progn (setq sum (apply '+ (mapcar 'atof (mapcar 'vla-get-textstring (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))))) ) (alert (strcat "Summ = " (rtos sum 2 3))) ) ) (princ) ) (prompt "\n\t\t***\tProgram loaded. Type SUM to execute...\t***") (princ) ~'J'~ Quote
Butch Posted November 5, 2009 Author Posted November 5, 2009 Fixo youre the greatest! Thanx a bunch! :-) Quote
fixo Posted November 5, 2009 Posted November 5, 2009 Fixo youre the greatest!Thanx a bunch! :-) C'mon, you're welcome Get to work ~'J'~ Quote
kindy52 Posted November 6, 2009 Posted November 6, 2009 FIXO THAT IS GREAT! Mind taking a look at this attachment? Is there a way to run the same lisp and it give you the result to paste where the yellow number is? Or alter the yellow number to the sum of the selection? What do ya think? SUM FLSG.dwg 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.