- (defun C:Test (/ sel en)
- (if (setq sel (entsel "\n选择线段或多段线:"))
- (if (wcmatch (cdr (assoc 0 (entget (setq en (car sel))))) "*LINE")
- (progn
- (X_DATA_ADD en "SIZE" '((1000 . "CT50X50")))
- (princ "\n数据"CT50X50"已附加在该图元上。")
- )
- (princ "\n无效图元。")
- )
- (princ "\n没有选中图元。")
- )
- (princ)
- )
-
- ;----------------------------------------------------------
- ; Extended data Utilities and Example of use
- ; From 1999 Autodesk University course PR31
- ; taught by Bill Kramer
- ;;---------------------------------------------------------
- ;; X_DATA_ADD 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
- )
|