leonucadomi Posted 7 hours ago Posted 7 hours ago hello: I would like to know if there is any LSP routine that helps me define the definition of attributes like similar to Tcount from master LEE MAC . Here I attach an example dwg of the entities that I need to quantify thanks example.dwg Quote
BIGAL Posted 5 hours ago Posted 5 hours ago I have something that would have done what you want, but it looks for blocks with attributes, I personally only ever make blocks with say a single attribute. Complicating it even more the display is the tag names. It's not a very nice dwg. lastly the answer is in lst3 but you have not said what you want done with it. ; count attdefs via tagname ; BY AlanH July 2025 (defun c:wow ( / lst lst2 att cnt lst3) (defun my-count (a L) (cond ((null L) 0) ((equal a (car L)) (+ 1 (my-count a (cdr L)))) (t (my-count a (cdr L)))) ) ; By Gile (defun remove_doubles (lst) (if lst (cons (car lst) (remove_doubles (vl-remove (car lst) lst))) ) ) (setq ss (ssget '((0 . "ATTDEF")))) (setq lst '()) (repeat (setq x (sslength ss)) (setq att (vlax-ename->vla-object (ssname ss (setq x (1- x))))) (setq lst (cons (vlax-get att 'tagstring) lst)) ) (setq lst (acad_strlsort lst)) (setq lst2 (remove_doubles lst)) (foreach val lst2 (setq cnt (my-count val lst)) (setq lst3 (cons (list val cnt) lst3)) ) (princ) ) 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.