Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Anonymous
502 Vistas, 6 Respuestas

Calculating numeros text statistics

Hello,

I have this layer, with numeros text objects and I´m trying to figure out statistics about them

for example

amosweislib_0-1585663279549.png

here I want to calculate Max, Min and Average of the selected texts

Anybody knows how do I do it?

 

Thanks

ВeekeeCZ
en respuesta a: Anonymous

Yes, learn to program! Prob the simplest would be a LISP:

 

(vl-load-com)
  
(defun c:TextStats ( / lst)
  (if (and (setq lst (ssget '((0 . "TEXT"))))
	   (setq lst (mapcar '(lambda (x) (distof (cdr (assoc 1 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex lst))))))
    (princ (strcat "\nMin: " (vl-princ-to-string (apply 'min lst)) " - Max: " (vl-princ-to-string (apply 'max lst)) " - Avr: " (rtos (/ (apply '+ lst) (float (length lst))) 2 3))))
  (princ)
  )

 

Anonymous
en respuesta a: ВeekeeCZ

Hey, Thanks for the reply!

I'm struggling a bit with your solution,

Iv'e put your code in the command line and nothing turned out,

I guess that's not the way to do it

could you please be more specific?

Thanks

 

I must say that I usually dont work with CAD so I'm not really from that world

ВeekeeCZ
en respuesta a: Anonymous

How about use google to learn how to run a LISP ?!

 

http://www.lee-mac.com/runlisp.html

Anonymous
en respuesta a: ВeekeeCZ

Jeez, what´s with the attitude?

 

Whatever,

thanks for your help

ВeekeeCZ
en respuesta a: Anonymous

Well, there is no other solution than write a program that will do that.

And you're not even capable to search how to use it. So. Sorry that I wrote that program, I should not.

R_Tweed
en respuesta a: Anonymous

Hello,

There is another option available that doesn't require you to learn a programming language. If you are familiar with excel the calculations are pretty easy to do. The max, min and average functions are straight forward.

 

1. use the dataextraction wizard to extract the values by layer to an xls file.

2. open the xls file and add your functions.

3. You can also import the data into a table within autocad and add formulas at the bottom. (something to explore)