- (defun c:addatt (/ doc obj vbj blocks
- blockname block ipoint insertionpoint
- attheight attmode attprompt atttag attvalue
- )
- (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
- (setq obj (car (entsel)))
- (setq vbj (vlax-ename->vla-object obj))
- (setq blocks (vla-get-blocks DOC))
- (setq blockname (vla-get-name vbj))
- (setq block (vla-item blocks blockname))
- (setq ipoint (cdr (assoc 10 (entget obj))))
- (setq insertionPoint (apply 'vlax-3d-point ipoint)
- attHeight 1
- attMode acAttributeModeVerify
- attPrompt "提示"
- attTag "标记"
- attValue "好喜欢菜卷鱼"
- )
- (vla-AddAttribute
- block attHeight attMode attPrompt insertionPoint attTag attValue)
- ;;;手动去attsync
- (vl-cmdf ".ATTSYNC" "S" obj "Y" )
- )
|