sadhu Posted April 24, 2013 Posted April 24, 2013 I have used the code below to add attributes to blocks in a drawing - it works perfectly but when I double click (or launch _eattedit) the block I get the block editor. What I want is just want enahanced attribute editor ( _eattedit). Is it because of the att_mode flag setting ? (setq att_mode 1) Is it some parameter setting of the original block ( dxf 70 set to 0) ? When I use the command "_eattedit" I get "The selected block has no editable attributes." In block editor I see the block does have attributes. Can someone please explain this behaviour ? Thanks Most of the code is from here slightly tweaked. (defun c:AddAtt(/ acadObject activeDoc blockList f dataline datalist blockname att_name text_height att_mode att_value frutti_lst att_lst) (vl-load-com) (setq blockList (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) ;Grab list of blocks in active document (defun ValidItem (collection item / res) (vl-catch-all-apply '(lambda () (setq res (vla-item collection item)))) res ) (setq text_height 0.15) ;setting the text height for the att (setq att_mode 1) ;27 ;setting the mode for the att (F1 or google "AFLAGS") (setq insertion_point (vlax-3d-point 0.0 0.0 )) ;setting the insertion point - need to use the vlax method for the command to work correctly (setq frutti_lst (list '"A$C02DC2393" ; blocks that I want to modify '"A$C052026BF" '"A$C0E387E4B")) (setq att_lst (list "NAME" "HEIGHT" "ORIENT")) (foreach n frutti_lst (setq blockname n) (setq att_value "") (foreach i att_lst (setq Att_Name i) (if (setq targetblock (ValidItem blockList blockname)) (vla-addattribute targetblock text_height att_mode att_name insertion_point att_name att_value )) (setq att_value "") );foreach i );foreach n (princ) );defun Quote
neophoible Posted April 26, 2013 Posted April 26, 2013 Well, I don't know the answer here, but did you check to make sure the attributes are actually editable, e.g., not constant (Sorry, but I did not review or test the code). You might post the block for evaluation. Quote
sadhu Posted May 2, 2013 Author Posted May 2, 2013 The problem was "attsync". I resolved it with the command : .... (command "_.attsync" "name" "*") ..... Thanks guys. Quote
dbroada Posted May 2, 2013 Posted May 2, 2013 I'm glad you're sorted but in case you don't know, or in case somebody else wanders by with the same problem..... Although graphical changes to one block update all other identical blocks immediately, this is not true of attributes. All blocks currrently inserted in a drawing will retain their previous attribute data - that is value and position. Any new insertion will take on the new definition. You must use the ATTSYNC command to synchronise all the attributes so that all blocks are again identical. This is a major problem when all attributes are deleted. All the previous blocks continue to work but new instances don't. If you attsync now ALL the attribute definitions disappear! Quote
Recommended Posts
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.