Scale transform on TextEntity not working


I’m running into an issue where transforming a TextEntity with a scaling transform does not work:

Both the text and the rectangle are transformed with the same matrix, yet the text height does not change.
Am I missing something or is this a bug, see code below to test:


import Rhino
import scriptcontext as sc

text_geom = Rhino.Geometry.TextEntity()
text_geom.TextHeight = 100
text_geom.Text = 'foo-bar'

bbox = text_geom.GetBoundingBox(True)
box_poly = Rhino.Geometry.PolylineCurve([bbox.Corner(0,0,0) , bbox.Corner(1,0,0), bbox.Corner(1,1,0), bbox.Corner(0,1,0), bbox.Corner(0,0,0)])

text_id1 = sc.doc.Objects.Add(text_geom)
print 'text_geom.TextHeight ',text_geom.TextHeight
box_id1  = sc.doc.Objects.Add(box_poly)

xform = Rhino.Geometry.Transform.Scale(Rhino.Geometry.Point3d(200,200,200), 0.3)
_ = [geom.Transform(xform) for geom in [text_geom,box_poly]]

print 'text_geom.TextHeight ',text_geom.TextHeight
text_id1 = sc.doc.Objects.Add(text_geom)
box_id2  = sc.doc.Objects.Add(box_poly)

Hi @Willem,

To scale the height of text, you’ll need to multiply the text entity’s text height with the scale factor.

There is a new ScaleTextHeight command in the Rhino WIP, by the way.

– Dale

Hi Dale.

Thanks for the quick answer.

I now see there is this as well: TextEntity.Transform (Transform, DimensionStyle)

I’ll play around with both setting the textheight after transform and passing DimStyle along.