How to get multiple Elevation Marker Locations

I found a python script that accurately finds the point of an elevation marker. (For some reason, the scripts that require the active view do not provide the the marker location, just a point that is associated with the view.)

import clr

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

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

em = UnwrapElement(IN[0])

if em.HasElevations:
	OUT = doc.GetElement(em.GetViewId(2) ).Origin.ToPoint()
else:
	OUT = "this marker has no views"

(My view ID happens to be 2 instead of zero; this was intentional).

The problem is that it doesn’t seem to work very well with lists; I can only feed in one elevation marker.
I am not very familiar with python though and I was wondering if someone could help me out.

Here is a snapshot of the graph:


The python script that accepts a list is displaying points for a bounding box. They are way off.
Get elevation marker location.dyn (14.8 KB)

Thanks

Python - Getting XYZ from Location

Why not wrap the python in a custom node?

Thanks @jacob.small, I will give it a shot.
Also, would you know how to add an input for the view Id?
Sometimes the index is 2, but other times it is 0.

Never mind that last question.
@jacob.small, that was very helpful.
I have to correct myself though - the python script that you want to use for this task is the one shown below. I guess it helps if your Dynamo preview is not turned upside-down :stuck_out_tongue_winking_eye:

import clr

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

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

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elev = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])

bbox = elev.BoundingBox[view]
minPt = bbox.Min.ToPoint()
maxPt = bbox.Max.ToPoint()

OUT = minPt, maxPt

bounding Box of an Elevation Marker

1 Like

Hi @daniel1
Did this work for you? The first Python script you posted worked for me but, as you say, it only works with one elevation marker. I can’t seem to get the latter script to work though. Did I miss a step?

Honestly, its been kinda finicky. It seems to work better in big projects and not so well in smaller ones. Strange behavior and I’m not sure why.