I have multiple instances of a block(same attributes) in a drawing and want to put different information in each attributes. I was told to use attout/attin. I used attout to get all of the handles on the drawing and wrote them down. Let's say we have handle 472A2 and 472A3 - 2 blocks that are same and they have an Attribute 'TAG1'.
I have this section of code that used to handle this by having the user select which block and then puts the info from cell 0 into TAG1:
Code:
(if vl
(progn
(setq en (entsel "\nSelect Block: "))
(setq blkobj (vlax-ename->vla-object (car en)))
;; change attributes
(setq attribs (vlax-invoke blkobj 'getattributes))
(foreach attref attribs
(cond ;;DYNAMIC DATA FROM EXCEL SPREADSHEET;;
((eq (vla-get-tagstring attref) "TAG1")
(vla-put-textstring attref (nth 0 vl)));A2 TO "TAG1" (LANE #)
Can someone help me so the user doesn't pick blocks, it automatically searches for the 2 handles (and other blocks on the drawing) I used above and puts the info from cell 0 into each block instance. I also need a conditional that if the cell is blank (nil) do nothing but if there is info, for example, in cell (nth 10 vl) change DESCX to info in cell (nth 10 vl), change DESCY to a text constant "METER" and DESCZ to "PRESET". I do this so I can set up the DWG template showing all spares. All of the blocks aren't the same but some are and I don't know how to "handle" that - pun intended.
If need be, I can supply sample XLS, the rest of the code, and a sample DWG