将文本样式更改为注释性
大家好,我的公司希望更改以前非注释性文字样式的属性,使其具有注释性。样式更改将在所有新项目的公司模板中设置,但这显然不会影响任何现有文件。我正试图写一些代码,包括在我们的阿卡多克。lsp文件,因此它将对打开的任何文档进行此更改。
;;; change KARPL text style to annotative if it exists in a drawing
;; get style object if it exists
(setq styleobj (tblsearch "STYLE" "KARPL"))
(if (= styleobj nil)
(prompt "\nKARPL does not exist.")
)
;;if it does exist
(if (/= styleobj nil)
;;get style entity name
(setq stylename (tblobjname "STYLE" "KARPL"))
;;get xdata for entity
(setq annotx (cadr (assoc -3 (entget stylename '("AcadAnnotative")))))
;;get value of second 1070 dxf code
(setq bAnnotative (cdr (nth 4 annotx)))
;;if either there is no xdata or the second 1070 code is 0, the style is not annotative
(if (OR (= annotx nil) (=bAnnotative 0))
;;write correct xdata
(setq exdata '((-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}")))))
(setq styleobj (subst exdata (assoc -3 styleobj)))
;;set text height to 1/16"
(setq styleobj (subst (cons 40 0.0625) (assoc 40 styleobj) styleobj))
;;modify styleobject
(entmod styleobj)
)
(princ);_ end if
)
我不知道如何将更正的扩展数据和新的文本高度写回样式实体。其他一切似乎都起作用了。
页:
[1]