Opposite of Box.PointAt Method?

Hi All,

Was wondering if there is a RhinoCommon method for doing the opposite of the Box.PointAt() method? That is, get the box parameters for a given Point3d. If not, any suggestions for how to calculate these?

Cheers and best,


This seems to do the trick:

import Rhino as rc

def closestBoxParameters(box,pt):
    """ Gets the closest box parameters for a point """
    # Make lines for each box axis
    bO = box.Plane.Origin
    lX = rc.Geometry.Line(bO,box.Plane.XAxis,box.X.Max)
    lY = rc.Geometry.Line(bO,box.Plane.YAxis,box.Y.Max)
    lZ = rc.Geometry.Line(bO,box.Plane.ZAxis,box.Z.Max)
    # Get params on lines
    tX = lX.ClosestParameter(pt)
    tY = lY.ClosestParameter(pt)
    tZ = lZ.ClosestParameter(pt)
    return (tX,tY,tZ)

Only as long as the box is aligned to the world axes.

You sure Menno? It seems to work okay with a box that’s been rotated off the world axes (it’s quite rare I dip into the box structure, so might well be wrong here):