PickPoint on Element's Geo

You probably tried to use Selection.PickPoint method and it didn't work as expected...

If you need a point right on the element's geometry you should try using Selection.PickObject method with ObjectType.PointOnElement.It's a bit tricky because you get a Reference and not the XYZ point, but you can get the point with a few lines of code.

Pick Point on the Geometry

To save you the trouble, I've prepared this function that will do it for you.

def pick_point_on_geo():
    """Prompt user to select point on Element's Geometry."""
    # 1. Prompt PickObject with PointOnElement option
    from Autodesk.Revit.UI.Selection import ObjectType
    pt_ref = uidoc.Selection.PickObject(ObjectType.PointOnElement)

    # 2. Get element's Geometry from Picked Point
    element = doc.GetElement(pt_ref)
    geo     = element.GetGeometryObjectFromReference(pt_ref)

    if geo:
        uv = pt_ref.UVPoint
        pt = geo.Evaluate(uv)
        return pt

Example

I've used this function to pick points on the geometry of my X-Mas tree for ornaments. If you try to use Selection.PickPoint you will notice that it can go through elements' geometry.


⌨️ Happy Coding!
Erik Frits