- (Defun lm-get-attribute (ty sx / lstattrs lstvar tagstring textstring vn0)
- (setq vn (vlax-ename->vla-object ty))
- (setq lstVar (vla-getattributes vn))
- (setq lstAttrs (vlax-safeArray->list (vlax-variant-value lstVar)))
- (setq TextString nil)
- (foreach attr lstAttrs
- (setq TagString (vla-get-TagString attr))
- (if (equal TagString sx) ;此处为你想要的元素
- (setq TextString (vla-get-TextString attr))
- )
- )
- TextString
- )
- (defun set-clip-string (str / html result)
- (and (= (type str) 'str)
- (setq html (vlax-create-object "htmlfile"))
- (setq result (vlax-invoke (vlax-get (vlax-get html 'parentwindow) 'clipboarddata ) 'setdata "text" str))
- (vlax-release-object html)
- )
- )
- (set-clip-string (lm-get-attribute(car(entsel"\n选择属性块:")) "A"))
|