Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check if attribute exists in the block table

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
1176 Views, 1 Reply

Check if attribute exists in the block table

I know how to check if a block in the drawing has a specific attribute, but how do I find if the block definition (in block table) has the attribute?
1 REPLY 1
Message 2 of 2
hmsilva
in reply to: Anonymous


@Anonymous wrote:
... but how do I find if the block definition (in block table) has the attribute?

One way

 

;; (attdef-p "YoutBlockName" "YourAttTag")
;; If true returns T otherwise nil
(defun attdef-p (blkname tag / a b e)
  (if (setq b (tblobjname "block" blkname))
    (while
      (and
        (setq b (entnext b))
        (setq e (entget b))
      )
       (if (and (= (cdr (assoc 0 e)) "ATTDEF")
                (= (cdr (assoc 2 e)) tag)
           )
         (setq a T)
       )
    )
  )
  a
  )

 

Hope that helps

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost