oh, you must have knowing about Xdata to do it.You can find it's infomation with Google ^^
Or use that simple example not use vla :
Code:
;;;;;;;;This to get Xdata infor
(defun X_DATA_GET (EN APID / EL)
(setq EL (entget EN (list APID)))
(cdadr (assoc -3 EL)) ;;return only data items
)
; This add extended data list DLST with
;; application name APID to the entity list
;; of entity name EN.
;; Overwrites existing.
;;
(defun X_DATA_ADD (EN APID DLST / EL TMP1)
(if (null (tblsearch "APPID" APID)) ;;registered?
(regapp APID)) ;;register it
(setq EL (entget EN) ;;get Entity list
TMP1 (list -3 (cons APID DLST))
)
(if (< (xdsize TMP1) (xdroom EN)) ;;got enough room?
(entmod (append EL (list TMP1)))) ;;modify database
)
;;;;;This to get Pline length
(defun Length1(e) (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)))
;;Now go to use :
;Add doublelength to Pline that you select
(X_data_add (setq en (car(entsel))) "Doublelength" (list (cons 1040 (* 2 (length1 en)) )))
;Read infor later :
(cdr(assoc 1040 (x_data_get (car(entsel)) "Doublelength")))