Hdong Posted April 17 Posted April 17 On 3/4/2024 at 11:32 PM, fuccaro said: Try this: (defun c:pp( / ss) (setq ss (ssget "_:L" '((0 . "INSERT")(2 . "PLANT")(66 . 1))) sum 0) (repeat (setq i (sslength ss)) (setq b1 (ssname ss (setq i (1- i)))) (while (and (/= (cdr (assoc 0 (setq b1l (entget b1)))) "SEQEND") (/= (cdr (assoc 2 b1l)) "PLANTGPM")) (setq b1 (entnext b1)) ) (setq n1 (read (cdr (assoc 1 b1l))) sum (+ sum n1)) ) ) Welcome in the Forum! Hi, I am new to this post and found this lisp works great as I wish. Is it possible to make it select one time with varies attribute blocks ? Thank you so much Hung Quote
mhupp Posted April 17 Posted April 17 (edited) This uses nentsel to select the attribute iteslf inside the block along with a while loop to keep adding to sum until you not select anything. untested & done in notepad. BlockSum.lsp Edited April 17 by mhupp 1 Quote
BIGAL Posted April 19 Posted April 19 @mhupp has given you a good answer, if you have say one block name but inserted multiple times and want to add the same attribute from all those blocks it can be done with a single pick that returns block name and attribute tag name, then just select blocks and a sum will be produced, @mhupp has a good check is it a number in his code. Can you confirm what it is exactly your asking for. 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.