ATTEDIT dialog updates all blocks

ATTEDIT dialog updates all blocks

Anonymous
Not applicable
1,135 Views
3 Replies
Message 1 of 4

ATTEDIT dialog updates all blocks

Anonymous
Not applicable

I've been away from this for a while (rusty).  I have several title blocks with attributes on different layout tabs.  The ATTEDIT command pulls the attribute info from the block to a dialog.  It works great for one sheet but I do not want to do this 50 times.  Is it possible to make the changed to all other blocks that are on each layout tab?  If so how? 

 

 

0 Likes
1,136 Views
3 Replies
Replies (3)
Message 2 of 4

Ranjit_Singh
Advisor
Advisor

You could update the block definition for any future inserts and it should show the new attributes from that point on. But for all the existing blocks you need to iterate through every single insert and update it. LISP can do it for you, but you need to identify exactly which tag values you are changing to what. I am sure something similar can be found searching through this forum.

If you already did search the forum then post a sample drawing identifying which tags to change and some one should be able to help you out. 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Ok I got it to work, sort of.  Using AutoCAD Mechanical 2015.  I have a drawing with a block called TB_ATT inserted twice.  When I run POP_TBA and add the values only one block changes, when I run it again both blocks change, this is what I want the first time.

 

Let me say thanks to those I have borrowed code to make this mess.

 

Improvements:

  • select the block
  • The block attribute values fill the dialog  (if it uses a dcl like attedit would be idea)
  • change same named blocks globally the first time.

Any tips would be much appreciated.

 

 

 I can't attached the drawing.  😞

 

Block named TB_ATT with the tags below.

 

Block tags.png

 

 

 

0 Likes
Message 4 of 4

Ranjit_Singh
Advisor
Advisor

A lot of people out here are experts in DCL and I will let them take a stab at modifying the code. meanwhile here is something that you can use. Call the function as (somefunc '("DWG_NO." "REV" "ECN_NO.") '("Value1" "Value2" "Value3"))

(defun somefunc  (lst1 lst2 / ent entdata)
 (mapcar '(lambda (x)
	   (setq ent x)
           (while (/= "SEQEND" (cdr (assoc 0 (setq entdata (entget (setq ent (entnext ent)))))))
           (mapcar '(lambda (x y)
                     (if (= x (cdr (assoc 2 entdata)))
                      (entmod (subst (cons 1 y) (assoc 1 entdata) entdata))))
                   lst1
                   lst2)))
         (mapcar 'cadr (ssnamex (ssget "_X" '((0 . "INSERT") (2 . "TB_ATT"))))))
 (princ))

 

0 Likes