For our plugin I need to know the “top left” corner of a Text Object’s TextGeometry.
Normally this is easy because it is text.TextGeometry.Plane.Origin
It is also shown by Rhino as a White dot (I have labelled A in the screenshot below.
Which produces the red arrows in the screenshot – as you can see the Text @ -135 degrees is not at B which is the point I am trying to find text rotation.3dm (43.9 KB)
My first thought is to rotate the text (copy) from it’s existing plane back to the world-xy plane. Then make your calculations and transform the results, from the world-xy plane back to the text’s original plane.
I have found a work around by rotating the Rhino Object so that it has zero rotation - then calculating the BoundingBox so that I can compute the true Text Width and Height. I then rotate the Text back to where it was and proceed.
I believe the root problem here was that TextEntity does not override the TextModelWidth method from AnnotationBase in order to account for the text rotation - this causes erroneous text widths to be reported. Indeed the AnnotationBase method just returns the width of the bounding box which will be wrong if the text has any rotation. The diagram below demonstrates this - the TextModelWidth is the length of the Red line - the Arc is present to show where i think the length value is coming from - the width of the bounding box.