有趣的建议BIGAL,这可能是一个更方便的版本:
- ; http://www.cadtutor.net/forum/showthread.php?100975-I-need-an-Autocad-LISP-for-Listing-Beam-Sizes
- ; Simple field attributes - original concept by BIGAL
- (defun C:test ( / e )
- (and (or (setq e (car (entsel "\nSelect attributed block: "))) (prompt "\nInvalid selection."))
- (vl-every '(lambda (x) (member x (entget e))) '((0 . "INSERT") (66 . 1)))
- (progn
- (foreach att (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)
- (and (vlax-write-enabled-p att)
- (setq e (car (nentsel (strcat "\nSelect object for "" (vla-get-TagString att) "" attribute: "))))
- (vl-some
- '(lambda (x)
- (if (vlax-property-available-p (vlax-ename->vla-object e) x)
- (vla-put-TextString att
- (strcat "%<\\AcObjProp Object(%<\\_ObjId "
- (itoa (vla-get-ObjectId (vlax-ename->vla-object e)))
- ">%)." x ">%"
- ); strcat
- ); vla-put-TextString
- ); if
- ); lambda
- '("Length" "TextString") ; "Area" could be added, list is sorted by priority
- ); vl-some
- ); and
- ); foreach
- (vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)
- ); progn
- ); and
- (princ)
- ); defun
|