get the dxf xdate straight in your head before you venture into the ActiveX version ..
In Jeff's code the '("*") represents return ALL Xdata Application Names
in your case you could use
(setq i1 (entget (car (entsel)) '("test1")))
since "test1" was your xdata APPName
Have a play with something like these to learn ...
(defun put-xdata (appName Data / elst exdata)
;; codehimbelonga kwb@theSwamp
(regapp appName)
(setq elst (entget (car (entsel "\nSelect graphical entity: ")))
exdata (list (list -3 (cons appName Data)))
elst (append elst exdata)
)
(entmod elst)
)
(defun c:put-xdata1 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME" (list (cons 1000 "Test Data"))))
)
(defun c:put-xdata2 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME" (list (cons 1070 2))))
)
(defun c:put-xdata3 (/ )
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME"
(list
(cons 1000 "DataList3")
(cons 1002 "{")
(cons 1070 3)
(cons 1000 "Test String 3")
(cons 1002 "}")
)
)
)
)
(defun c:put-xdata4 (/)
;; codehimbelonga kwb@theSwamp
(setq entityList (put-xdata "TEST-APPLICATION-NAME"
(list
(cons 1000 "DataList4")
(cons 1002 "{")
(cons 1070 4)
(cons 1000 "Test String 4 ")
(cons 1002 "}")
(cons 1000 "DataList4a")
(cons 1002 "{")
(cons 1070 44)
(cons 1000 "Test String 4a")
(cons 1002 "}")
)
)
)
)
(defun get-xdata (appName / myData)
;; codehimbelonga kwb@theSwamp
(setq myData
(cadr
(assoc
-3
(entget
(car
(entsel
"\nSelect graphical entity to extract Data : "
)
)
(list appName )
)
)
)
)
myData
)
(defun c:get-xdata (/ )
(setq entityData (get-xdata "TEST-APPLICATION-NAME" ))
)
(defun c:get-ACADxdata (/ )
;; for dimensions, etc
(setq entityData (get-xdata "ACAD" ))
)
(defun c:get-ALLxdata (/ )
(setq entityData (get-xdata "*" ))
)