@Anonymous wrote:
(if (= 0.0 (cdr (assoc 40 (tblsearch "Style" (getvar "textstyle")))))
(command "TEXT" "J" "bc" "812631.354936753,824937.620605355,0" (getvar "textsize") "" "4.939")
(command "TEXT" "J" "bc" "812631.354936753,824937.620605355,0" 0.2 "" "4.939")
)
This will test if the current text style has a height of 0, if so it uses the current textsize, otherwise it uses 0.2 text height
That's not it, because if the current Text Style has a non-zero defined height, there will be no prompt for the height to which that 0.2 would be the answer. So it will use 0.2 to answer the rotation-angle prompt that will be waiting at the time, and "" for the content, and "4.939" will cause an unknown-command error.
Also, if you want to use the current TEXTSIZE setting when the current Style has no fixed height, you don't need to extract the value of the System Variable, but can simply use Enter [""], because it will be the default that is offered.
It's hard for me to believe that the OP would really want to do this and take whatever happens to be the current Text Style, rather than specifying a particular one, unless they actually never use more than one Style in any drawing or this is part of something larger that sets the Style, and the Style is always defined with zero height. But if that's really what they want to do, and there might be some Styles with defined heights and some without, and they want the 0.2 height if the current Style doesn't have a fixed one of its own, I would go about it this way, eliminating a lot of redundancy, since most of the command is the same either way:
(command "TEXT" "J" "bc" "812631.35,824937.62,0")
(if (= 0.0 (cdr (assoc 40 (tblsearch "Style" (getvar "textstyle")))))
(command 0.2 "" "4.939"); then -- use 0.2 in original
(command "" "4.939"); else -- no height prompt to be answered
)
[I also shortened the rather astonishing 9-digit precision in the X & Y coordinates, but that's not necessary.]
Kent Cooper, AIA