23 jun. 2009

Rutina cuenta bloques iguales de una misma capa

;|comando "blcont" cuenta bloques iguales a uno señalado
siempre que estén en la misma capa indicada.
****Prexem - 2009****
(defun C:blcont (/ cmdechant nomb lista cant)
(setq cmdechant (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq ent (car (entsel "\nseleccione bloque a contar: ")))
(setq vle (vlax-ename->vla-object ent))
(setq nomb (vlax-get vle "name"))
(setq cap (vlax-get vle "layer"))
lista (ssget "_x"
(list (cons 0 "INSERT") (cons 2 nomb) (cons 8 cap))
(setq cant (sslength lista))
(strcat "\nCantidad de bloques con nombre " nomb ": ")
(princ cant)
(setvar "cmdecho" cmdechant)

1 comentario:

Oliver dijo...

I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.