Block Name Tag Replace

Block Name Tag Replace

Anonymous
Not applicable
971 Views
2 Replies
Message 1 of 3

Block Name Tag Replace

Anonymous
Not applicable

It's me again.. Everyone from my last "Projekt" will roll his eyes exactly at this point. 😄

 

 

Easy as that. I guess.. ?

 

---------------------------------

If the block only got one Attribute change the name of the Attribute to "C".

 

Don't want to insert old Tag name or Block name - Just the condition - If only one Attribute - Change Name to "C".

---------------------------------

 

The more i work with LISP the more i think im retardet.. Thanks for the Help before hand.

Last Posts about the topic, atleast close the Topic.

 

Change Attribute Tags by their Position instead of the Name

Blockreplace - keeping Value with same Attribute tags

Change every Attribute Tag Gloabally

 

As always Inb4 some asks - cant post a example .dwg, sorry about that.

0 Likes
Accepted solutions (1)
972 Views
2 Replies
Replies (2)
Message 2 of 3

Sea-Haven
Mentor
Mentor
Accepted solution

try this

(setq  doc (vla-get-activedocument (vlax-get-acad-object)))
(setq allblocks (vla-get-blocks doc))
(vlax-for block allblocks
   (setq tot 0)
   (setq bname (vla-get-name block))
        (vlax-for ent block
                (if (=  (vla-get-objectname ent) "AcDbAttributeDefinition" )
                     (setq tot (+ tot 1))
                 )
          )
    (if (= tot 1)
        (vlax-for ent block
            (if (=  (vla-get-objectname ent) "AcDbAttributeDefinition" )
                 (vla-put-tagstring ent "C")
             )
        (command "attsync" "Name" bname)
        )
    )
)
0 Likes
Message 3 of 3

Anonymous
Not applicable

Works Perfectly Fine! Thank you very much!

0 Likes