How to get the elevation from a ReferencePoint

Hello all,

For a project I am dealing with adaptive components in my models. I need to get the elevation of the adaptive points in the family. I made a script that collects the points and when you output them you can see that it is a ReferencePoint object with a location XYZ.

However I don’t seem to be able to grab the Z component from this. Point.Z gives me the error ‘AttributeError: ‘ReferencePoint’ object has no attribute ‘Z’’.
Inputting the point into the node ReferencePoint.Z does work, but this is not what I want because I want to contain everything in one script. Does anybody know what could be going on here? Am I missing a reference somewhere?

# Load the Python Standard and DesignScript Libraries
import sys
import clr
from Autodesk.DesignScript.Geometry import *

from Autodesk.Revit.DB import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import Revit

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

adap_points = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_AdaptivePoints).WhereElementIsNotElementType().ToElements()

z_coord = [point.Z for point in adap_points]

OUT = z_coord

Hi @johanboo,

Try with :

import Revit
from Revit.Elements import *

z_coord = [point.Location.ToPoint().Z for point in adap_points]

Or z_coord = [point.Position.ToPoint().Z for point in adap_points]

The properties in the API :

1 Like

Thank you @Alban_de_Chasteigner

Adding the reference to GeometryConversion and using z_coord = [point.Position.ToPoint().Z for point in adap_points] did the trick! Apparently I was dealing with Revit points and I needed to convert them to Dynamo geometry first to be able to extract the elevation.

More explanation here: