I have a lisp routine that draws a balloon (elongated if necessary) around a single line of text.
Because of the variable nature of text (font style, width, obliquing angle, etc.), I wanted some means of measuring the length of the user entered textline so I could accurately calculate whether the balloon needed elongating, and if so, by how much. I also wanted to pick up the *exact* centre of the textline (allowing for risers, descenders, font width, obliquing angle, etc.) and then place the textline exactly centre of the balloon.
The only way I can find of accurately measuring the textline is to use the Textbox command.
I initially draw the textline off-screen, apply Textbox and then use the Textbox returned diagonal coordinates to calculate the length of the textline (as a distance) and the exact centre of the textline (as a point). The textline is then moved from its off-screen position to the centre of the balloon.
Textbox returns its bounding box points (lower left, upper right) as if the textline's insertion point were located at (0, 0, 0), although this seems to assume Left justified text and I am using MC justified text. Because of this, I have to translate the textline 'exact centre' point. At the moment I achieve this by setting the UCS to the text object and using:
(trans 1 0) followed by (command "UCS" "P")
This translates the point from the current (object) UCS to the World UCS.
I'm not sure if this is the best way to achieve what I want. Also, the routine will fail if the user is not in the World UCS when the lisp routine is run.
I thought I might check to see what the current UCS is, but cannot find a command to give me this information. UCSNAME returns " " when in World.
Can anyone suggest a better way to calculate the 'exact centre' point and then move the text by that point to the balloon centre, possibly without using Trans?