Finding point coordinates / location

My code (“obj” is a valid Guid):

bb = rs.BoundingBox(obj)
result = rs.PointDivide(rs.PointAdd(bb[6], bb[0]), 2.0)

According to the documentation this returns a point.

rs.IsPoint(result) returns False though…
So I cannot get the coordinates using rs.PointCoordinates(result).

How do I get the coordinates of “result”?

You are perhaps confused as to the difference between a Rhino point (one that you see on screen) and a RhinoCommon/Python ‘Point3d’ object.

All objects that are stored in a Rhino file have a unique ID (GUID). Rhinoscriptsyntax references objects by their ID. An on-screen point has an ID associated with it; when you select it in a script, this ID is used to identify it.

RhinoCommon ‘Point3d’ objects are actual points in 3d space; like other objects in RhinoCommon/Python they have both Properties and Methods. One of the properties of a Point3d are of course it’s X, Y, and Z coordinates.

rs.BoundingBox() returns a list of 8 corner points. These are Point3d objects - they do not exist in the document and do not have ID’s. Your way of finding the bounding box center is correct and ‘result’ is actually a Point3d. However, it is not a Rhino document point - it does not exist in the document thus it does not have an ID. rs.IsPoint(obj) will return True if the `obj’ in question (referenced by its GUID) is actually a Rhino point stored in the document. That is not the case, so that is why it returns False.

Rhino points are objects with ID’s, to get their numerical coordinates you need to use rs.PointCoordinates(point_id) to get them.

Point3d objects do not need this, their world coordinates are inherent properties. You can access these coordinates via pt.X, pt.Y, and pt.Z where pt is the Point3d object. In your case it would be result.X, result.Y, result.Z.