Borgunit,
I used this code:
(defun C:inlet ()
(vl-load-com)
(setq PT1 (getpoint "\nSelect Insertion Point"

BLK_NAME "test";
SCLFAC 1.0
)
(command "_.INSERT" BLK_NAME PT1 SCLFAC "" ""

(setq BALENT (cdr (assoc -1 (entget (entlast)))))
(setq ATTLIST
(vlax-safearray->list
(variant-value
(vla-getattributes (vlax-ename->vla-object BALENT))
)
)
)
(setq TAGNAME "XY";
PTLIST (strcat (rtos(car PT1)2 4) "," (rtos(cadr PT1)2 4)) ;PTS to X,Y
) ;setq
(foreach ITEM ATTLIST
(if (= (vla-get-tagstring ITEM) TAGNAME)
(vla-put-textstring ITEM PTLIST)
) ;if
) ;foreach
(princ)
) ;defun
I renamed the lsp to "inlet". When I tried using a block (named test, a small poygon with a node at center) with no attributes defined, I get a message after insert prompt, "Select Insertion PointActiveX Server returned an error: Invalid index".
I tried redefining the block to where I have an "XY" attribute tag already defined, I get the message, "Select Insertion PointUnterminated Complex Entity
ActiveX Server returned an error: Invalid index".
Hmmmmmm.......What do you think?