本帖最后由 Andyhon 于 2012-8-15 15:35 编辑
- ;;; [url=http://www.afralisp.net/archive/lisp/dclatt2.htm]http://www.afralisp.net/archive/lisp/dclatt2.htm[/url]
-
- ;;; (defun getatt (enam)
- (defun getatt (enam / taglist txtlist)
- ;retrieve the attributes
- (setq thelist (vlax-safearray->list
- (variant-value
- (vla-getattributes enam))))
- ;process each attribute
- (foreach n thelist
- ;get the tag attribute data
- (setq taglist (cons (vla-get-tagString n) taglist)
- ;get the text attribute data
- txtlist (cons (vla-get-textString n) txtlist)
- ;how many attributes?
- lg (length taglist)
- );setq
- );foreach
- ;reverse the lists
- (setq taglist (reverse taglist)
- txtlist (reverse txtlist))
- )
- ;;; 图形必需可见
- (defun W-dwg (blk / strs)
- (setq pt (cdr (assoc 10 (entget blk)))
- p1 (mapcar '- pt '(5 12))
- p3 (mapcar '+ pt '(93 126))
- ss (ssget "C" p1 p3)
- txts (getAtt (vlax-ename->vla-object blk))
- )
- (foreach txt txts
- (if (wcmatch txt "#########*")
- (setq strs (cons txt strs))
- )
- )
- (vl-cmdf "wblock" (car strs) "" pt ss "")
- )
- ;;; for test only
- (vl-load-com)
- (defun c:test ()
- (mapcar 'W-dwg (sslist (ssget '((2 . "tk_a4")))))
- )
;;; sslist 函数 站内有
|