将以下保存为文件"tqksx.lsp",加载后,在命令行输入tqksx,选取带属性的块即列其属性。- (defun c:tqksx()
- (vl-load-com)
- (while (setq ent (car (entsel "\n请选取属性块:")))
- (if (= (cdr (assoc 0 (entget ent))) "INSERT")
- (if (= (vlax-get (setq obj (vlax-ename->vla-object ent)) "HasAttributes") -1)
- (progn
- (setq att (vlax-invoke obj "GetAttributes"))
- (setq jgb (mapcar '(lambda(aobj) (list (vlax-get aobj "TagString")
- (vlax-get aobj "TextString")
- )
- )
- att
- )
- )
- (princ "\n属性列表=")(princ jgb)
- )
- )
- )
- )
- (princ)
- )
|