如何用autolisp提取cad文件中的所有文字样式,并将文字样式名罗列出来?

2024-11-30 12:59:15
推荐回答(2个)
回答1:

(defun get-textstyle ( )
(if (null vlax-dump-object) (vl-load-com) )
(setq txts (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object))))
(setq txtl '())
(vlax-for txt txts
(setq txtl (cons (vla-get-name txt) txtl))
)
(reverse txtl)
)

;;函数(get-textstyle)返回的值就是当前图档中包含的所有文字样式的表

回答2:

;;获取当前图档中所有文字样式的列表
;;(get-style)
(defun get-style ( / list-sty key data-sty name-sty)
(setq list-sty nil)
(setq key T)
(while (setq data-sty (tblnext "style" key))
(setq name-sty (cdr (assoc 2 data-sty)))
(setq list-sty (cons name-sty list-sty))
(setq key nil)
)
(reverse list-sty)
)