Hey everyone,

My company wants to change the properties of a previously non-annotative text style to make it annotative. The style change will be set in the company template for all new projects, but that obviously won't affect any existing files. I'm trying to write some code to include in our acaddoc.lsp file so it will make this change to any document that is opened.

Code:
;;; 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
)
I'm having trouble figuring out how to write the corrected xdata and the new text height back to the style entity. Everything else seems to work.