rs.GetBox() returns "unordered" vertices

Hi all!
The rs.GetBox() from RhinoScriptSyntax returns an array of eight 3D points that are the box vertices. I thought that the first 3D point in the array would be the first point selected by the user, but it is not. Depending on the orientation/position of the selected points, the first point will be one or another (in bottom/top bases). The same happens with the rest of the points. Would it be possible for GeBox() to return the points sorted by the order in which they were selected, just like GetRectangle() works? Thanks!

I believe the results are based on the active CPlane, and the first point will always be the box minimum - i.e. the point that has the lowest values in X, Y, and Z. From that point, the other points are returned in ccw order around the base, then around the top.

Yeah. Once the first and second points are defined, rest are known by ccw order and the same in opposite base. But I did not know how the first and second points are defined. Thx!

GetBoxSortedVertices.py (3.4 KB)

I have created a GetBoxSortedVertices() function. I think it works fine, although the code could be better… hehe. The first, second and third points are defined in order of selection. The fourth point is the last corner of the flat rectangle. The other four points on the opposite base are named in the same order.