Python - Getting XYZ from Location

Hi,

I’m writing some Python code which will process Elevation Markers, as as part of that it will move and rotate.

To rotate the marker I need to obtain the markers location via:

elevmark = UnwrapElement(IN[0]) - this is a Dynamo node selecting the marker.

elevmarkloc = elevmark.Location

This returns: Autodesk.Revit.DB.Location

But I cant see how I can obtain an XYZ from that - the API help does not list any method or property for obtaining this…

Is there anyway I can get this?

Thanks.

Try elevmarkloc.Point or elevmarkloc.Point.ToPoint() if you need a Dynamo Point

Point is a property of the LocationPoint class: http://revitapisearch.com/html/e1071a1b-b98e-5875-2e13-b673e2b9fef6.htm

elevmark.Location returns an Autodesk.Revit.DB.Location object, this does not have any methods or properties such as Point or ToPoint… and so I cant do what you suggest…

The Location class only contains: Dispose, Equals, GetHashCode, GetType, Move, Rotate, ToString and IsReadOnly - not very much…

None of which seem to return its XYZ location.

Location marks doesn’t seem to have any available properties that describes its location:

Yea - thats what I found.

So how do you work out the position of an ElevationMarker? I’ve a routine which has placed some but I now need to rotate it to the correct angle…?

You can easily rotate it wiith ElementTransformUtils.RotateElement, but it’s difficult to figure out the correct axis of rotation without the location point of the ElevationMarker.

Yes, that exactly why I’m trying to obtain the location! I intend to use ElementTransformUtils…

What if you use the origin of the associated view? Looks like they match up pretty close.

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

element = UnwrapElement(IN[0])

OUT = element.Origin.ToPoint()
2 Likes

OK, thanks,but I’m looking to keep the whole thing in Python as I will eventually convert it into C#… So far all of my routine is in Python.

I can’t see any way of getting from (or converting) an ElementMarker class object to an Element class object in Python…

There seems to be very little you can do with a ElementMarker.

I appreciate your help.

Hi Kevin,

Have another look at the API, there seem to be quite a few things that you can do with an elevation marker. For example:

2 Likes

I have the same issue trying to get the location point of ceilings, all I have is Autodesk.Revit.DB.Location, but methods or attributes like Point, ToPoint, Toxyz, etc. don’t work. Any idea?
image

please start a new topic and refer to this one if needed.

Don’t revive a 3year old topic.

Ok, thanks!