The Revit API does not seem to have enabled certain aspects of either Location or LocationPoint with respect to TextElements. When using the code below, the result is the error "Object reference not set to an instance of an object". As noted with comments, it claims to get a Location, and also a LocationPoint, but there is nothing in the .Point.X (Y Z). Note also that I am picking an actual TextElement in the first line.
Reference One_Pick = uiDoc.Selection.PickObject(ObjectType.Element, "Select First Text");
Id1 = One_Pick.ElementId;
One_Pikt = uiDoc.Document.GetElement(One_Pick) as TextElement;
Location One_Location = One_Pikt.Location;//does not fail;
LocationPoint One_Pt = One_Location as LocationPoint;//does not fail;
Double XX = One_Pt.Point.X; Double YY = One_Pt.Point.Y; Double ZZ = One_Pt.Point.Z;//fails setting XX
What I am wanting to do is either sort multiple text elements by location, or else MOVE a text so it's justification point is at the midpoint or end of an object.
Revit version is 2016