做下笔记
有用到的朋友自行拿去用就行了。- ;获取普通块内的文字,测试完成。
- ;测试 (XX-Get-BlockTexts(vlax-ename->vla-object(car(entsel"\n选择块: "))))
- ; =>("文字2" "文字1")
- (defun XX-Get-BlockTexts(blkobj / obj strlst)
- (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
- (if (= (vla-get-objectname blkobj) "AcDbBlockReference")
- (vlax-for obj (vla-item blks (vla-get-name blkobj))
- (if (= (vla-get-objectname obj) "AcDbText")
- (setq strlst (cons (vla-get-TextString obj)strlst))
- )
- )
- )
- strlst
- )
|