试试看。。应该完成你想要的。
- (defun c:xrb (/ bl ed n tbl tx)
- (vlax-for a (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
- (if (and (= -1 (vlax-get a 'islayout))
- (setq ed (vla-getextensiondictionary a))
- (setq tbl (vla-addobject ed "Acad_Sortents" "AcDbSortentsTable"))
- )
- (progn (vlax-for b a
- (setq n (vla-get-objectname b))
- (cond ((and (= "AcDbBlockReference" n) (vlax-property-available-p b 'path))
- (setq bl (cons b bl))
- )
- ((wcmatch n "AcDb*Text,*Dimension*,*Leader*") (setq tx (cons b tx)))
- )
- )
- (and bl (vl-catch-all-apply 'vlax-invoke (list tbl 'movetobottom bl)))
- (and tx (vl-catch-all-apply 'vlax-invoke (list tbl 'movetotop tx)))
- (mapcar 'set '(bl tx) '(nil nil))
- )
- )
- )
- (vla-update (vlax-get-acad-object))
- (princ)
- )
- (vl-load-com)
|