Jump to content

Recommended Posts

Posted
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

Posted (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 by mhupp
  • Like 1
Posted

@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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...