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

Check number of attribute tags the same

2 REPLIES 2
Reply
Message 1 of 3
andrewscott99
239 Views, 2 Replies

Check number of attribute tags the same

Hi there

How do i go about checking if there are 2 attribute tags call 'rev' in a block called 'DyerA1'...? I would like to alert the user if so.

Many Thanks

A
2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: andrewscott99

In simplest terms, for only that block name and attribute tag:

{code}
(setq item (tblobjname "block" "DyerA1"))
(while (setq item (entnext item))
(if (= (cdr (assoc 2 (entget item))) "REV")
(if found1
(progn ; then - second one
(alert "DyerA1 contains more than one REV Attribute Tag.")
(quit)
); end progn
(setq found1 T) ; else - first one
); end if
); end if
); end while
{code}

That will also answer the same if there are three or more, not just if there are two.

It wouldn't be hard to make it [for instance] identify whether a Block definition has *any* duplicate Attribute Tags. Or it could announce *how many* REV Attribute Tags it contains [only one, or perhaps more than two]. It could be made not as a command but as a function, to take arguments for Block and Attribute Tag names, for more generalized use. Etc., etc.

--
Kent Cooper


andrewscott99 wrote...
How do i go about checking if there are 2 attribute tags call 'rev' in a block called 'DyerA1'...? I would like to alert the user if so.
Kent Cooper, AIA
Message 3 of 3

Perfect, Thanks again! Only need it to check that one block.

A

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

Post to forums  

Autodesk Design & Make Report

”Boost