Rhino 6 text bounding box

I have an rvb script that checks for text (auto generated by another script) intersecting with curves (for annotations on plans) so that our CAD operators can move the text.

Because on large drawings it can be time consuming it does it in 2 stages, first it calculates bounding boxes for each text object and intersects them with the rest of the drawing, and if an intersection is found it then explodes a copy of the text object to the outlines of the text and re-evaluates those intersections before alerting the operator of an intersection.

In Rhino 6 the bounding box for text seems to be much bigger than the text object, whereas in Rhino 5 it was very close to the extents of the text. I have tested the boundingbox command and that produces the same result, so its not part of the script that is causing the issue. Is there any reason that the bounding box for text objects only is now so much bigger?

UPDATE: this seems to be only where the text isn’t aligned with the world coordinate system (including, for example, text at a 45deg angle in world top when re-setting the cplane so that cplane x is in line with the bottom of the text object). When aligned to any world aligned cplane the bounding box works as it did in Rhino 5.

Hello - I see that… thanks for the report. I do not have a short term solution other than to explode the text and get that BB. Let me think a little… Is this a RhinoScript or Python, or?

https://mcneel.myjetbrains.com/youtrack/issue/RH-46608

-Pascal

My script is written in RhinoScript, but when generating the bounding box I’m just calling Rhino.Command “boundingbox”.

I’ve just tried using the RhinoScript boundingbox function, and perhaps unsurprisingly, it generates the same bounding box as the bounding box command.

The script isn’t used that regularly (we’ve had Rhino 6 for a few weeks now, and this is the first time I’ve used it), so we can work around it, but would be good to see a fix in an upcoming Rhino update.

The hacky workaround until this is fixed is to transform the text object to world XY, get the bounding box and then translate the box back… This is a quick hack with python/rhinoscriptsyntax, I can clean it up later if it’s useful…

import rhinoscriptsyntax as rs
obj=rs.GetObject("Select text object",512,True)
if obj and rs.IsText(obj):
    plane=rs.TextObjectPlane(obj)
    xform=rs.XformRotation1(plane,rs.WorldXYPlane())
    txtx=rs.TransformObject(obj,xform,True)
    bb=rs.BoundingBox(txtx)
    rs.DeleteObject(txtx)
    if bb:
        xform=rs.XformRotation1(rs.WorldXYPlane(),plane)
        bbx=rs.PointArrayTransform(bb,xform)
        rs.AddPolyline([bbx[0],bbx[1],bbx[2],bbx[3],bbx[0]])

–Mitch

Thanks Mitch

That does sound like a suitable workaround until the real issue can be fixed.

No need to tidy your script, I’m sure I can work your concept into my existing script.