Place circles to all the blocks which has different block name and different attribute values on the same attribute tag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is the Lisp from @ВeekeeCZ, i am trying to modify.
Need to look for the block name "DT_TAP2PLG,DT_TAP4PLG,DT_TAP8PLG" and Attribute tag "tap_val". need to place circles for block ins point in different colours for different attribute values and finally need to show alert msg, number of circles placed for each attribute value, segregated by blockwise.
Attaching the Dwg file for better understanding.
@ВeekeeCZ Please check this, this is your program which you written on my other similar post, i am trying to modify for other blocks. its counting and placing circles but not by block name wise.
Please help.
(defun c:tap_eq ( / r e i e l a v c);
(setq r '(("DT_TAP2PLG" . ": 2port")
("DT_TAP4PLG" . ": 4port")
("DT_TAP8PLG" . ": 8port")))
(if (setq s (ssget "_X" (list '(0 . "INSERT") (cons 2 (apply 'strcat (mapcar '(lambda (x) (strcat (car x) ",")) r))) '(8 . "NS_RF CONSTRUCTION" )(cons 410 (getvar 'ctab)))))
(repeat (setq i (sslength s))
(setq e (ssname s (setq i (1- i))))
(if (not (vl-catch-all-error-p (setq v (vl-catch-all-apply 'getpropertyvalue (list e "tap_val")))))
(setq l (if (setq a (assoc v l))
(subst (append a (list e)) a l)
(cons (list v e) l))))))
(if l
(progn
(if (setq a (assoc "" l)) (setq l (subst (cons "BLANK" (cdr a)) a l)))
(setq c 0 l (vl-sort l '(lambda (u v) (> (length u) (length v)))))
(foreach v l
(setq c (1+ c))
(foreach e (cdr v)
(entmake (list '(0 . "CIRCLE") (assoc 10 (entget e)) '(8 . "circles") '(40 . 25) '(370 . 40) (cons 62 c)))))
(alert (apply 'strcat (mapcar '(lambda (x) (strcat "\n" (car x) " - " (itoa (1- (length x))) " circles placed.")) l)))))
(princ)
)
Thank you.