Get the element of the selected edge

It’s probably stupidly simple but i cant figure out how to get the the displayed element id of the selected egde

screenshot1

maybe someone can point me in the right direction, thanks

OOTB, I am not sure how to do that. But using springnodes, we can add an additional output to his node.
image

Paste the following python script into a fresh Python node.

#Copyright(c) 2016, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com

import clr

clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

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

sel1 = uidoc.Selection
ot1 = Selection.ObjectType.Edge
refs = sel1.PickObjects(ot1, "Select the desired edges and press Finish")
edges = []
for i in xrange(len(refs)):
	el1 = doc.GetElement(refs[i].ElementId)
	edge = el1.GetGeometryObjectFromReference(refs[i])
	edges.append(edge.AsCurve().ToProtoType())
OUT = edges,el1
4 Likes

Thanks, worked perfectly

1 Like